Last active
October 24, 2023 21:30
-
-
Save ethanclevenger91/c8b26b1c7b3bc5d482844913508e4b6e to your computer and use it in GitHub Desktop.
Add private pages to WordPress menu builder
this doesnt seem to work any longer in version 6?
It's not working in WP v6
as mentioned here in comment: https://stackoverflow.com/a/42181485/4375061
the filter needs a higher prio.
then it's working for me at WP v 6.1.1.
add_filter( 'nav_menu_meta_box_object', 'show_private_pages_menu_selection', 99 );
/**
* Add query argument for selecting pages to add to a menu
*/
function show_private_pages_menu_selection( $args ){
if( $args->name == 'page' ) {
$args->_default_query['post_status'] = array('publish','private');
}
return $args;
}
Thanks @AndreKelling
Thanks for sharing this, it's a very powerful principle 👌
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Fab1en Welp, that's super obvious in retrospect...