[wp-trac] [WordPress Trac] #8592: Private Pages not listed in the Parent dropdown
WordPress Trac
noreply at wordpress.org
Wed Sep 28 12:47:22 UTC 2016
#8592: Private Pages not listed in the Parent dropdown
-------------------------------------------------+-------------------------
Reporter: mtdewvirus | Owner:
Type: enhancement | SergeyBiryukov
Priority: normal | Status: assigned
Component: Posts, Post Types | Milestone: Future
Severity: major | Release
Keywords: ux-feedback needs-testing has-patch | Version: 2.7
| Resolution:
| Focuses:
| administration
-------------------------------------------------+-------------------------
Comment (by lkraav):
@sillybean need to be careful with `pre_get_posts`. This can be fired
earlier than you might think and `get_current_screen()` may not exist yet.
Adding `is_main_query()` helps.
{{{#!diff
diff --git a/inclusive-parents.php b/inclusive-parents.php
index a74ff4c..a485c13 100644
--- a/inclusive-parents.php
+++ b/inclusive-parents.php
@@ -91,7 +91,7 @@ add_filter( 'the_title',
'scl_menu_checklist_status_label', 10, 2 );
* @return object $query
*/
function scl_menu_screen_add_private_pages( $query ) {
- if ( is_admin() && 'nav-menus' == get_current_screen()->base ) {
+ if ( is_admin() && $query->is_main_query() && 'nav-menus' ==
get_current_screen()->base ) {
$query->set( 'post_status', array( 'publish', 'private',
'password' ) );
}
return $query;
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/8592#comment:212>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list