WordPress parent select need to be removed

Per comments a way around it is to set the post_type to something that isn’t a hierarchical type in the filter, as the wp_dropdown_pages() function used to populate the select calls get_pages() which just returns without doing anything if the post_type isn’t hierarchical. So using a non-existent post_type works:

function limit_parents_wpse_106164( $args ) {
    $args['post_type'] = 'does_not_exist';
    return $args;
}

Note that the original filter idea comes from @brasofilo here.

Leave a Comment