Skip to content

Commit

Permalink
WP-r44338: Correctly show post type hierarchy in admin (#333)
Browse files Browse the repository at this point in the history
In https://core.trac.wordpress.org/changeset/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 https://core.trac.wordpress.org/changeset/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.

WP:Props davidbinda.
Fixes https://core.trac.wordpress.org/ticket/45711.

Conflicts:
src/wp-admin/includes/post.php
----
Merges https://core.trac.wordpress.org/changeset/44338 / WordPress/wordpress-develop@47584c7bc0 to ClassicPress.

See #263.
  • Loading branch information
Mte90 authored and nylen committed Jan 28, 2019
1 parent ce080b2 commit 5ba06a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/wp-admin/includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -1086,10 +1086,10 @@ 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) ) {
$query['orderby'] = 'menu_order title';
$query['order'] = 'asc';
$query['posts_per_page'] = -1;
if ( is_post_type_hierarchical( $post_type ) && empty( $orderby ) ) {
$query['orderby'] = 'menu_order title';
$query['order'] = 'asc';
$query['posts_per_page'] = -1;
$query['posts_per_archive_page'] = -1;
$query['fields'] = 'id=>parent';
}
Expand Down

0 comments on commit 5ba06a7

Please sign in to comment.