Include Private/Draft Pages In Parent Dropdowns

Screen Shot 2014-09-02 at 3.52.08 PMBy default, WordPress only includes published pages in the dropdown select menu that allows you to choose a parent for a particular page. This is a pretty well documented problem that is yet to be addressed in core. Not a huge issue, however it can cause some pretty pesky problems.

For example, say you have a parent page and a child page that aren’t quite ready to share with the world, so you want to make them private. So you edit the parent page and set it to private. Then you go to the child page to set it to private. Alas, the parent page will no longer appear in the dropdown “parent” menu, and thus if you save the child page at all, it becomes parentless. No fun, right?

So this snippet fixes that problem by adding private and pending (awaiting review) pages to the parent dropdown menu – and it works for bulk editing, quick editing, and editing in a single page view. If you want to tweak the post_status types that are included, just edit the array listed in the code, using values from the WP_Query codex page.