Make WordPress Core

Changeset 33266


Ignore:
Timestamp:
07/14/2015 04:17:06 PM (9 years ago)
Author:
helen
Message:

List tables: Even more robust fallback for the primary column.

Since WP_List_Table::get_default_primary_column() can be overridden in a subclass and columns can be further filtered, it is possible to end up with a primary column that no longer exists. This is particularly evident in list tables for custom post types that have been altered via filter.

props ocean90.
fixes #32996.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r33178 r33266  
    888888        $default = $this->get_default_primary_column_name();
    889889
     890        // If the primary column doesn't exist fall back to the
     891        // first non-checkbox column.
     892        if ( ! isset( $columns[ $default ] ) ) {
     893            $default = WP_List_Table::get_default_primary_column_name();
     894        }
     895
    890896        /**
    891897         * Filter the name of the primary column for the current list table.
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r33197 r33266  
    10701070     */
    10711071    protected function get_default_primary_column_name() {
    1072         return( 'title' );
     1072        return 'title';
    10731073    }
    10741074
Note: See TracChangeset for help on using the changeset viewer.