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. Built from https://develop.svn.wordpress.org/trunk@33266 git-svn-id: http://core.svn.wordpress.org/trunk@33238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1f18ef86a3
commit
4182df24f8
|
@ -887,6 +887,12 @@ class WP_List_Table {
|
||||||
$columns = $this->get_columns();
|
$columns = $this->get_columns();
|
||||||
$default = $this->get_default_primary_column_name();
|
$default = $this->get_default_primary_column_name();
|
||||||
|
|
||||||
|
// If the primary column doesn't exist fall back to the
|
||||||
|
// first non-checkbox column.
|
||||||
|
if ( ! isset( $columns[ $default ] ) ) {
|
||||||
|
$default = WP_List_Table::get_default_primary_column_name();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the name of the primary column for the current list table.
|
* Filter the name of the primary column for the current list table.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1069,7 +1069,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
* @return string Name of the default primary column, in this case, 'title'.
|
* @return string Name of the default primary column, in this case, 'title'.
|
||||||
*/
|
*/
|
||||||
protected function get_default_primary_column_name() {
|
protected function get_default_primary_column_name() {
|
||||||
return( 'title' );
|
return 'title';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.3-beta2-33265';
|
$wp_version = '4.3-beta2-33266';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue