七牛镜像存储 WordPress 插件(修改版本 ,可单独用不更新)

20170411184224.png

七牛支持传统 CDN 的镜像存储,对于很多 WordPress 站点来说,有了这个功能,就无需将原来的图片上传到七牛的服务器上,只需在 WordPress 站点做些简单的修改,就可以使用七牛的 CDN 服务了,真正一键实现 WordPress 博客静态文件 CDN 加速。

因为原作者他强行更新了新版本无法单独使用,所以我就修改了版本号,链接防止自动更新,简单可用!
2017/4/29更新修正了原作者对老版本问答的处理,删除了360库等,不报错了.

qiniu.zip

wordpress 隐藏账号,保护安全

wordpress万年漏洞 author漏洞 ,官方应该不打算修复。下面提供方法

http://www.yoursite. com/?author=1,多用户的可以把1变为2、3、4、5等,就可以在地址栏查看到各个用户名。

知道了后台登陆地址和用户名后,剩下的就是用暴力破解密码了,如果没有任何防护的话,成功指数相当高。

为了保障我们的后台安全,建议安装一个Limit Login Attempts插件,来限制强行登陆的次数,同时修改后台登陆地址和隐藏我们的用户名。

修改后台登陆地址:

在所用主题的functions.php文件的?>前面添加以下代码即可实现。

//使用昵称替换用户名,通过用户ID进行查询
add_filter( 'request', 'wpdaxue_request' );
function wpdaxue_request( $query_vars )
{
    if ( array_key_exists( 'author_name', $query_vars ) ) {
        global $wpdb;
        $author_id = $wpdb->get_var( $wpdb->prepare( "SELECT user_id FROM {$wpdb->usermeta} WHERE meta_key='nickname' AND meta_value = %s", $query_vars['author_name'] ) );
        if ( $author_id ) {
            $query_vars['author'] = $author_id;
            unset( $query_vars['author_name'] );    
        }
    }
    return $query_vars;
}
 
//使用昵称替换链接中的用户名
add_filter( 'author_link', 'wpdaxue_author_link', 10, 3 );
function wpdaxue_author_link( $link, $author_id, $author_nicename )
{
    $author_nickname = get_user_meta( $author_id, 'nickname', true );
    if ( $author_nickname ) {
        $link = str_replace( $author_nicename, $author_nickname, $link );
    }
    return $link;
}

PS:昵称里一定用英文名

WordPress 免插件实现外链转内链 Go 跳转,减少权重流失

<?php 
//$t_url=$_GET['url']; //此代码无法支持带请求参数的目的地址,已弃用!
$t_url = preg_replace('/^url=(.*)$/i','$1',$_SERVER["QUERY_STRING"]); //这个支持
if(!empty($t_url)) {
    preg_match('/(http|https):\/\//',$t_url,$matches);
        if($matches){
            $url=$t_url;
            $title='页面加载中,请稍候...';
        } else {
            preg_match('/\./i',$t_url,$matche);
            if($matche){
                $url='http://'.$t_url;
                $title='页面加载中,请稍候...';
            } else {
                $url='http://xubiji.com/';
                $title='参数错误,正在返回首页...';
            }
        }
} else {
    $title='参数缺失,正在返回首页...';
    $url='http://xubiji.com/';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="2;url='<?php echo $url;?>';">
<title><?php echo $title;?></title>
<style type="text/css">
a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}body{background:#3498db}#loader-container{width:188px;height:188px;color:#fff;margin:0 auto;position:absolute;top:50%;left:50%;margin-right:-50%;transform:translate(-50%,-50%);border:5px solid #3498db;border-radius:50%;-webkit-animation:borderScale 1s infinite ease-in-out;animation:borderScale 1s infinite ease-in-out}#loadingText{font-family:"Microsoft YaHei",Helvetica,Arial,Lucida Grande,Tahoma,sans-serif,Raleway,sans-serif;font-size:1.4em;position:absolute;top:50%;left:50%;margin-right:-50%;transform:translate(-50%,-50%)}@-webkit-keyframes borderScale{0%{border:5px solid #fff}50%{border:25px solid #3498db}100%{border:5px solid #fff}}@keyframes borderScale{0%{border:5px solid #fff}50%{border:25px solid #3498db}100%{border:5px solid #fff}}
</style>
</head>
<body>
<div id="loader-container"><p id="loadingText">   页面加载中...</p></div>
</body>
</html>

复制代码保存为 index.php 文件,然后上传到网站根目录下的 go 文件夹(没有 go 文件夹就新建一个),实现 http://www.172u.top/go/?url=http://www.172u.top/ 的跳转形式。

更新 robots 规则:
为了防止搜索引擎抓取这种跳转链接,我们可以在robots.txt里面新增禁止抓取/go的规则:

Disallow: /go

为导航菜单添加个性图标字体

具体方法:

一、WP后台--插件--安装插件页面搜索:Font Awesome 4 Menus,下载安装并启用。

如果在编辑菜单项目面板中无CSS类,可以打开右上角的“显示选项”,在显示菜单高级属性中勾选“CSS类”(最上面看开启)。

font1.jpg

WP Mail SMTP(可用于wordpress注册,密码找回)

WordPress的功能非常强大,可扩展性也很强大,有时候一些主机不支持mail(),以至于wordpress的自身无法使用密码找回功能!很多人一直在说 1.wordpress 密码无法重置密码 2.wordpress找回密码邮件 无效
这里就可以通通解决了!
下载:后台搜索WP Mail SMTP (最多评价的哪个应该就是)
但是现在有个插件可以实现SMTP发送设置便捷。

20170427154931.png