admin管理员组文章数量:1295335
I've got a site with a lot of custom user roles and capabilities, and I'm trying to allow users with a new capability 'admin_panel_access` (set up via User Role Editor) to access the admin dashboard.
No matter what I try - several different versions of access in functions.php (see below for my latest) - users with that capability cannot access /wp-admin at all.
function restrict_admin(){
if ( ! current_user_can( 'admin_panel_access' ) ) {
wp_die( __('You are not allowed to access this part of the site') );
}
}
add_action( 'admin_init', 'restrict_admin', 1 );
I've narrowed it down by changing theme and disabling plugins one by one, and the culprit is WooCommerce. For some reason, when I activate WooCommerce it stops roles with custom capabilities (other than edit_posts) being able to access.
Any clues or ideas would be fantastic. 5 hours of searching and testing is enough to drive anyone to madness!
Thanks.
本文标签: woocommerce offtopicAdmin access for custom user capabilities
版权声明:本文标题:woocommerce offtopic - Admin access for custom user capabilities 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741617630a2388618.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论