Make WordPress Core


Ignore:
Timestamp:
12/19/2018 10:27:51 PM (6 years ago)
Author:
desrosj
Message:

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.

Location:
branches/5.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

  • branches/5.0/src/wp-admin/includes/post.php

    r44248 r44339  
    10871087
    10881088    // Hierarchical types require special args.
    1089     if ( is_post_type_hierarchical( $post_type ) && !isset($orderby) ) {
     1089    if ( is_post_type_hierarchical( $post_type ) && empty( $orderby ) ) {
    10901090        $query['orderby'] = 'menu_order title';
    10911091        $query['order'] = 'asc';
Note: See TracChangeset for help on using the changeset viewer.