Code to Show Private Pages on Menu Screen Not Working
-
I’ve used the code below to make private pages show up in the Appearance->Menu screen so the user can add private pages to a menu. Which recently just stopped working, only public pages are showing up in the Page options to add to the menu.
1. There are no error in our error log, even with WP Debugging turned on.
2. I can put an echo ‘here’ in it and I can see that it is getting called.
3. I’m using a child theme of Twenty Fifteen/** * Add query argument for selecting pages to add to a menu */ function steele_show_private_pages_menu_selection( $args ){ if( $args->name == 'page' ) { $args->_default_query['post_status'] = array('publish','private'); } return $args; } add_filter( 'nav_menu_meta_box_object', 'steele_show_private_pages_menu_selection' );
Did something change when updating to 6.0 and navigation blocks? The site is still using Appearance->Menu for menus.
WP Version – 6.0.1
Server architecture – Linux 5.10.0-16-amd64 x86_64
Web server – Apache
PHP version – 7.4.30 (Supports 64bit values)
- The topic ‘Code to Show Private Pages on Menu Screen Not Working’ is closed to new replies.