Skip to content
Permalink
Browse files

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.

Merges [44338] to the 5.0 branch.

Props davidbinda.
Fixes #45711.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@44339 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
desrosj committed Dec 19, 2018
1 parent c22f4e7 commit a0e2d2ab0c74ea41ee662dedbec3fd363b72fd7e
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/wp-admin/includes/post.php
@@ -1086,7 +1086,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;

0 comments on commit a0e2d2a

Please sign in to comment.
You can’t perform that action at this time.