WordPress.org

Make WordPress Core

Ticket #8592: meta-boxes.diff

File meta-boxes.diff, 1023 bytes (added by davecpage, 4 years ago)

Allow filtering the args for parent dropdown on Page Attributes metabox

  • wp-admin/includes/meta-boxes.php

     
    560560function page_attributes_meta_box($post) { 
    561561        $post_type_object = get_post_type_object($post->post_type); 
    562562        if ( $post_type_object->hierarchical ) { 
    563                 $pages = wp_dropdown_pages(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)); 
     563                $pages = wp_dropdown_pages(apply_filters( 'page_attributes_dropdown_pages_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))); 
    564564                if ( ! empty($pages) ) { 
    565565?> 
    566566<p><strong><?php _e('Parent') ?></strong></p>