• Resolved fulviods

    (@fulviods)


    Hi,

    first thanks a lot for this amazing plugin.
    Using users panel, I hided different menu in the backend.
    All menus where I checked the box (like update core, settings->general….) are hided…except 2 submenus :
    – appearance->customize
    – appearance->background

    Because I can access the customize page from my theme-menu-link I paste this code in functions.php

    function remove_customize_page(){
    	global $submenu;
    	unset($submenu['themes.php'][6]); // remove customize link
    
    }
    add_action( 'admin_menu', 'remove_customize_page');

    So I succeeded to hide appearance->customize
    But impossible to hide appearance->background

    I read many posts here but didnt find a solution.
    If I deactivate “Edit theme options” in the capabilities menu , its all the “appearance menu” that disappear… and I need it because I want users to be able to access menu and widgets…

    Hope there is a solution,
    Thanks a lot

    https://ww.wp.xz.cn/plugins/advanced-access-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi fulviods,

    Appreciate your question.

    WordPress backend menu is “a box of surprises”. Customize and Background submenus are two exceptions that do not follow the typical backend menu standard. That is why the only way to manage access to those menus is to uncheck customize, edit_themes and edit_themes_options capabilities for your particular role or user.

    If I’m not wrong customize capability does not exist in the default list of WordPress capabilities. That is why you would have to create it first (on the Capabilities tab click Create button on the right top cornet).

    Regards,
    Vasyl

    Thread Starter fulviods

    (@fulviods)

    Hi ! Thanks

    Thats right customize dont exist. I created customize in the capabilities but it doesn’t change anything…

    In fact as soon as I deactivate “edit_themes_options” the “appearance” menu disappear !

    With my code in the function.php I succeeded deactivating the customize link but not the background… :/

    Hi fulviods,

    It is not a simple task when it comes to hide background menu. Probably the easier with be to extend your code with something like this:

    function remove_customize_page(){
    	global $submenu;
    
            foreach($submenu['themes.php'] as $i => $item) {
                if (in_array($item['0'], array(__('Customize'), __('Background')))) {
                    unset($submenu['themes.php'][$i]);
                }
            }
    
    }
    add_action( 'admin_menu', 'remove_customize_page');

    Regards,
    Vasyl

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘impossible to hide appearence background’ is closed to new replies.