mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
List Tables: Fix PHP error notice when $columns is null
Use of `register_column_headers()` and `print_column_headers()` creates a `_WP_List_Table_Compat` without any columns. When the List Table object doesn't have any columns, there's naturally no primary column. Props danielbachhuber. Fixes #34148. git-svn-id: https://develop.svn.wordpress.org/trunk@35698 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -902,6 +902,10 @@ class WP_List_Table {
|
||||
$columns = $this->get_columns();
|
||||
$column = '';
|
||||
|
||||
if ( empty( $columns ) ) {
|
||||
return $column;
|
||||
}
|
||||
|
||||
// We need a primary defined so responsive views show something,
|
||||
// so let's fall back to the first non-checkbox column.
|
||||
foreach ( $columns as $col => $column_name ) {
|
||||
|
||||
Reference in New Issue
Block a user