日度归档:2017-02-04

wordpress中如何用User Role Editor修改使用Meta Slider的权限

1、添加以下代码添加到functions.php

/**
 * You can change this to a different capability by pasting the code below into
 * your themes functions.php file.
 *
 * You can use the 'User Role Editor' plugin to add a custom capability to WordPress
 * specifically for Meta Slider users.
 */
function metaslider_change_required_role($capability) {
    return 'metaslider_use'; // this is the ID of a custom capability added using User Role Editor
}
add_filter('metaslider_capability', 'metaslider_change_required_role');

2、打开 用户User Role Editor
3、选择要修改权限用的角色
4、点击 Add Capability 添加 metaslider_use,然后钩选该属性
5、点击 UpdateYes

初级WordPress模板制作入门

一套完整的WordPress模板应至少具有如下文件:

style.css : CSS(样式表)文件
index.php : 主页模板
archive.php : Archive/Category模板
404.php : Not Found 错误页模板
comments.php : 留言/回复模板
footer.php : Footer模板
header.php : Header模板
sidebar.php : 侧栏模板
page.php : 内容页(Page)模板
single.php : 内容页(Post)模板
searchform.php : 搜索表单模板
search.php : 搜索结果模板

当然,具体到特定的某款模板,可能不止这些文件,但一般而言,这些文件是每套模板所必备的。
继续阅读

我是怎么防范 WordPress 大规模暴力破解攻击的

攻击者主要是首先扫描 WordPress 网站,然后通过穷举法攻击 WordPress 的默认用户名:admin。

其实可以通过以下三个步骤来减少被攻击以及被攻陷的机会:

1、 在当前 functions.php 添加以下代码去掉 WordPress 版本信息,减少被扫描到的机会。

remove_action( 'wp_head', 'wp_generator');

2、 默认的用户名不要为 admin,通过一下 SQL 修改 admin 的用户名:

UPDATE wp_users SET user_login = 'newuser' WHERE user_login =  'admin';

3、 安装 Limit Login Attempts 插件,限制登陆尝试次数,防止通过穷举法获取后台密码。