For clarity - here is a picture of the box I am talking about in this question:
Background: I have built a relatively complex WP site for a client which is more of a CMS than a blog and relies on a hierarchy of pages being built. (Well, they're actually custom post types with 'hierarchical' => true
set)
My question: is it possible to show draft (or pending review) pages in the page attributes 'Parent page' dropdown list? Without this, it means making each page live before the whole section is ready - and that's not a suitable solution.
What I've tried:
Saving a page as a draft lets you have a page set up and ready, but it isn't viewable to the public yet. This means you can create the page, edit it how you want, or even completely mess up the page, and nobody would even know. Drafts are only visible if you are logged into your website to make edits.
A parent page is a top-level page, with child pages nested under it. Parent page drop down in Page Settings. For example, you could have an “About” page as a top level or parent page, and then have child pages “Life Story” and “My Dogs” under it.
On your WordPress dashboard, go to Pages -> Add New. Enter the desired title and content. Open the Page tab and scroll down to Page Attributes. Choose a specific page to set as the parent from the drop-down menu.
Very nice question!
The following does it. One filter is for the edit page screen and the other for the Quick Edit menu.
Tested with a hierarchical custom post type.
add_filter( 'page_attributes_dropdown_pages_args', 'so_3538267_enable_drafts_parents' );
add_filter( 'quick_edit_dropdown_pages_args', 'so_3538267_enable_drafts_parents' );
function so_3538267_enable_drafts_parents( $args )
{
$args['post_status'] = 'draft,publish,pending';
return $args;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With