1

in my effort in making the WP backend as user friendly as possible, I'm looking for a way to limit the amount of child (or submenu items) of the menu(s) under "admin > appearance > menus". They idea is: when a theme doesn't support a second menu level, its should also not be possible in the backend to add (drag) items to this level.

I guess to achieve this, I would have to dive in the jQuery UI library (and more specifically the jQuery sortable library).

Preferably without having to edit WP's core. Does anyone has any idea or experience in this?

Looking forward to your ideas.

1

Just use remove_submenu_page( $menu_slug, $submenu_slug );.

  • $menu_slug = Parent page
  • $submenu_slug = Submenu page

Example usage:

// Remove the submenu page for widgets
add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() 
{
    remove_submenu_page( 'themes.php', 'widgets.php' );
}
  • Kaiser; thanx for your reply but it is NOT AT ALL related to my qustion. As mentioned in my post I'm talking about the customizable theme menu's under: "admin > appearance > menus". I think this is quite clear. – Marsman Apr 24 '12 at 17:26
  • Ah, this was a missunderstanding. In this case, your only option is to use jQuery (measure .length » disable), etc.). There're no hooks, as mostly of this page is hard coded. – kaiser Apr 24 '12 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.