你好@Carlos:
尝试将以下内容添加到主题functions.php
文件,或在.php
您可能正在编写的插件中的文件(适用于WordPress 3.1.x):
add_action(\'pre_user_query\',\'yoursite_pre_user_query\');
function yoursite_pre_user_query($user_search) {
$user = wp_get_current_user();
if ($user->ID!=1) { // Is not administrator, remove administrator
global $wpdb;
$user_search->query_where = str_replace(\'WHERE 1=1\',
"WHERE 1=1 AND {$wpdb->users}.ID<>1",$user_search->query_where);
}
}
如果你有WordPress 3.0。试试这个(因为WordPress没有添加
\'pre_user_query\'
钩至3.1):
add_action(\'pre_user_search\',\'yoursite_pre_user_search\');
function yoursite_pre_user_search($user_search) {
$user = wp_get_current_user();
if ($user->ID!=1) { // Is not administrator, remove administrator
global $wpdb;
$user_search->query_where = str_replace(\'WHERE 1=1\',
"WHERE 1=1 AND {$wpdb->users}.ID<>1",$user_search->query_where);
}
}