elin-r
12/5/2016 - 8:26 PM

WP Show Only Parents in Page Attributes Dropdown – http://stackoverflow.com/questions/14880043/how-to-hook-page-attributes-meta-box-to-chang

// Visa endast föräldrar i dropdown för sidattribut

add_filter( 'page_attributes_dropdown_pages_args', 'filter_dropdown_parents_only', 10, 2 );

function filter_dropdown_parents_only( $dropdown_args, $post )
{
    $my_args = array(
         'post_type'        => $post->post_type,
         'exclude_tree'     => $post->ID,
         'selected'         => $post->post_parent,
         'name'             => 'parent_id',
         'show_option_none' => '(no parent)',
         'echo'             => 0,
         'sort_order'       => 'DESC',
         'sort_column'      => 'post_date',
         'parent'           => 0
    );
    return $my_args;
}