admin管理员组文章数量:1023146
I've created following function to run a stylesheet for the admin area, but I want to runt it only for 'shop_manager' this user role and for others, it should not make any modifications from that stylesheet.
// Update CSS within in Admin
function admin_style() {
if (current_user_can( 'administrator' ) ) {
return admin_style();
}
wp_enqueue_style('admin-styles', get_stylesheet_directory_uri().'/admin.css');
}
add_action('admin_enqueue_scripts', 'admin_style');
Problem with it is, when I put shop_manager in user role section it loads only shop_manager's admin dashboard and not the Administrator's. And when I add ! current_user_can
it happens the same but vice versa. Please help!!
I've created following function to run a stylesheet for the admin area, but I want to runt it only for 'shop_manager' this user role and for others, it should not make any modifications from that stylesheet.
// Update CSS within in Admin
function admin_style() {
if (current_user_can( 'administrator' ) ) {
return admin_style();
}
wp_enqueue_style('admin-styles', get_stylesheet_directory_uri().'/admin.css');
}
add_action('admin_enqueue_scripts', 'admin_style');
Problem with it is, when I put shop_manager in user role section it loads only shop_manager's admin dashboard and not the Administrator's. And when I add ! current_user_can
it happens the same but vice versa. Please help!!
本文标签: admin cssRun function for specific user only
版权声明:本文标题:admin css - Run function for specific user only 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745478047a2152412.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论