Change WordPress user roles and capabilities Forums Bug Reports Disable metaboxes in pro not working

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2372
    nwconsulting
    Participant

    Hi,

    I hava a client site where the ability to disable metaboxes for specific roles does not appear to be working. I am using the latest version of Pro and have checked that the meta-boxes.php and added some debug code to try and see where the issue is. It would appear that the following lines is causing the metabox code to not be executed.

    if (!$this->is_restriction_aplicable()) {
    return;
    }

    If I comment out the “return” so then the metaboxes are disabled correctly.

    Any ideas why this might not be working unless I change this?

    Thanks

    #2375
    Vladimir
    Keymaster

    Hi,

    The code of this method is here:

    
    public function is_restriction_aplicable() {
            if ($this->lib->multisite && is_super_admin()) {
                return false;
            }
            
            if (!$this->lib->multisite && current_user_can('administrator')) {
                return false;
            }
    
            return true;
        }
    

    It means: do not restrict superadmin for WP multisite and do not restrict user with ‘administrator’ role for single WP.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.