[wp-trac] [WordPress Trac] #8592: Private Pages not listed in the Parent dropdown
WordPress Trac
wp-trac at lists.automattic.com
Thu Dec 15 19:31:17 UTC 2011
#8592: Private Pages not listed in the Parent dropdown
------------------------------+-----------------------------
Reporter: mtdewvirus | Owner: nacin
Type: enhancement | Status: reopened
Priority: normal | Milestone: Future Release
Component: Administration | Version: 3.3
Severity: major | Resolution:
Keywords: has-patch commit |
------------------------------+-----------------------------
Changes (by vinceger):
* version: 2.7 => 3.3
Comment:
Replying to [comment:129 kmklr72]:
> Like davecpage, I ran into this issue for a client. I wanted to fix it
without hacking core, and this function seems to be working fine (based on
3.2.1 stable):
>
>
> {{{
> function admin_private_parent_metabox($output)
> {
> global $post;
>
> $args = array(
> 'post_type' => $post->post_type,
> 'exclude_tree' => $post->ID,
> 'selected' => $post->post_parent,
> 'name' => 'parent_id',
> 'show_option_none' => __('(no parent)'),
> 'sort_column' => 'menu_order, post_title',
> 'echo' => 0,
> 'post_status' => array('publish', 'private'),
> );
>
> $defaults = array(
> 'depth' => 0,
> 'child_of' => 0,
> 'selected' => 0,
> 'echo' => 1,
> 'name' => 'page_id',
> 'id' => '',
> 'show_option_none' => '',
> 'show_option_no_change' => '',
> 'option_none_value' => '',
> );
>
> $r = wp_parse_args($args, $defaults);
> extract($r, EXTR_SKIP);
>
> $pages = get_pages($r);
> $name = esc_attr($name);
> // Back-compat with old system where both id and name were based
on $name argument
> if (empty($id))
> {
> $id = $name;
> }
>
> if (!empty($pages))
> {
> $output = "<select name=\"$name\" id=\"$id\">\n";
>
> if ($show_option_no_change)
> {
> $output .= "\t<option
value=\"-1\">$show_option_no_change</option>";
> }
> if ($show_option_none)
> {
> $output .= "\t<option value=\"" .
esc_attr($option_none_value) . "\">$show_option_none</option>\n";
> }
> $output .= walk_page_dropdown_tree($pages, $depth, $r);
> $output .= "</select>\n";
> }
>
> return $output;
> }
> add_filter('wp_dropdown_pages', 'admin_private_parent_metabox');
> }}}
>
> As you might be able to tell, it is pretty much just a copy of
wp_dropdown_pages from /wp-includes/post_template.php with a few
customizations. It could probably do with being cleaned up, but it seems
to be doing what I want for now. Hopefully it will help someone here.
Thank's 129 kmklr72 !
This did the trick with 'my problem' , other patches won't work here...
--
Ticket URL: <http://core.trac.wordpress.org/ticket/8592#comment:136>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list