Multiple depth settings for page attributes parent dropdown menu
-
I have a WordPress site with hundreds of pages, and I am trying to figure out the best way to minimize the number of pages that show up in the page attributes parent dropdown menu (I only need that menu to be 2 or 3 levels deep, depending on the parent page).
I searched online and found the following code:
// LIMIT PARENT DROPDOWN MENU TO TWO LEVELS function limit_parent_dropdown_menu( $args ){ $args['depth'] = '2'; return $args; } add_filter( 'page_attributes_dropdown_pages_args', 'limit_parent_dropdown_menu' ); add_filter( 'quick_edit_dropdown_pages_args', 'limit_parent_dropdown_menu' );
That code works almost perfectly for me, but it ends up hiding some pages that I need to see, or showing some pages that I’d rather be hidden (depending on what number I set the depth to).
Ideally I would like to have the ability to hide most pages that are 3 levels deep, but show some level 3 pages depending on the parent.
What I am trying to figure out is if there is a way to modify that code to use an if statement to set the depth to display 3 levels for a few certain parent pages that I specify, and 2 levels for everything else.
- The topic ‘Multiple depth settings for page attributes parent dropdown menu’ is closed to new replies.