Support » Plugin: Dynamic Widgets » Remove Dynamic Widgets from Appearance menu

  • Resolved WebEndev

    (@munman)


    I was wondering if there was a way to remove the admin link for Dynamic Widgets in the Appearance admin menu?

    I am enabling the Appearance menu for the editor role, and would like to remove the Dynamic Widgets submenu item.

    I’ve tried various times with remove_submenu_page, but have had no luck.

    Wouldn’t it be better to put the admin link under Settings instead of Appearance? This is where most plugin admin is put.

    Thanks!

    http://wordpress.org/extend/plugins/dynamic-widgets/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Qurl

    (@qurl)

    Please correct me if I’m wrong, but I don’t think an editor has “edit_theme_options” capabilities, so the menu item won’t be at least accessible.

    Thread Starter WebEndev

    (@munman)

    Please correct me if I’m wrong, but I don’t think an editor has “edit_theme_options” capabilities, so the menu item won’t be at least accessible.

    That is correct. Let me clarify.

    What I did was add

    $role = get_role('editor');
    $role->add_cap('edit_theme_options');

    to allow the editor role to see the Appearance menu (because I wanted them to be able to access Widgets, and Menus).

    I then added

    function we_custom_admin_menu() {
        $user = new WP_User(get_current_user_id());
        if (!empty( $user->roles) && is_array($user->roles)) {
            foreach ($user->roles as $role)
                $role = $role;
        }
    
        if($role == "editor") {
           remove_submenu_page( 'themes.php', 'themes.php' );
        }
    }
    add_action('admin_menu', 'we_custom_admin_menu');

    To remove the Themes submenu item.
    But the Dynamic Widgets submenu item is still there in the Appearance menu, because it is called with themes.php

    But I don’t want the Editor role to see the Dynamic Widgets submenu.

    So… how do I remove it?

    Thanks!

    Plugin Contributor Qurl

    (@qurl)

    Try
    remove_submenu_page( 'themes.php', 'dynwid-config' );

    Please be aware there is also a DW link within the Widgets Admin.

    Thread Starter WebEndev

    (@munman)

    Yeah, I already tried that. Didn’t work. Sorry…

    Plugin Contributor Qurl

    (@qurl)

    Did you also try
    remove_submenu_page( ‘themes.php’, ‘themes.php?page=dynwid-config’);

    Thread Starter WebEndev

    (@munman)

    Just tried
    remove_submenu_page( 'themes.php', 'themes.php?page=dynwid-config');
    That didn’t work either.
    I found another way to hide it as a work around.

    So I can get by…
    Thanks

    HI WebEndev —

    Do you mind sharing your solution to hiding the dynamic widgets from the appearance menu? I’d love to do the same thing.

    Thanks!

    Thread Starter WebEndev

    (@munman)

    Hi Feshin,

    I looked around, but couldn’t find my coded solution.

    This however http://wordpress.org/extend/plugins/admin-menu-editor/ works very well and will to it for you.

    Thanks, WebEndev! I’ll take a look at that plugin. Really appreciate you taking the time to respond!

    Plugin Contributor Qurl

    (@qurl)

    Thanks for sharing WebEndev!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Remove Dynamic Widgets from Appearance menu’ is closed to new replies.