Posts, Post Types: Correctly show hierarchical post type hierarchy in admin.

In [44185], a bug was introduced where hierarchical post types would not display in the correct default order (hierarchically).

This was caused by a `! isset()` check, which returned `false` after [44185], causing the correct default value to not be applied. This switches that conditional to use an `empty()` check, ignoring the new empty string assignment that was added to prevent a PHP notice when `compact()` is called.

Props davidbinda.
Fixes #45711.

git-svn-id: https://develop.svn.wordpress.org/trunk@44338 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2018-12-19 22:22:50 +00:00
parent d8968636b7
commit 47584c7bc0

View File

@ -1157,7 +1157,7 @@ function wp_edit_posts_query( $q = false ) {
$query = compact( 'post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page' );
// Hierarchical types require special args.
if ( is_post_type_hierarchical( $post_type ) && ! isset( $orderby ) ) {
if ( is_post_type_hierarchical( $post_type ) && empty( $orderby ) ) {
$query['orderby'] = 'menu_order title';
$query['order'] = 'asc';
$query['posts_per_page'] = -1;