admin管理员组

文章数量:1313962

I don´t clearly understand why this code does not work :

//Front-end profile page
global $current_user;
if ( current_user_can( 'edit_user') ) { ... }

$current_user output : ["allcaps"]=> array(6) { ["read"]=> bool(true) ["level_0"]=> bool(true) ["edit_user"]=> bool(true) ["view_admin_dashboard"]=> bool(true) ["subscriber"]=> bool(true) ["client"]=> bool(true) }

So, that is in the list !

even if I do this :

$role = get_role('client');
$role->add_cap('edit_user');
global $current_user;
if ( current_user_can( 'edit_user') ) { ... }

that does not work as well.

But with the capability 'read', that works perfectly.

Someone can help me and explain what happens ?

本文标签: user rolescurrentusercan( 39edituser39 ) does not work