WP_List_Table::get_default_primary_column_name
Gets the name of the default primary column.
Method of the class: WP_List_Table{}
No Hooks.
Returns
String. Name of the default primary column, in this case, an empty string.
Usage
// protected - for code of main (parent) or child class $result = $this->get_default_primary_column_name();
Changelog
| Since 4.3.0 | Introduced. |
WP_List_Table::get_default_primary_column_name() WP List Table::get default primary column name code WP 6.8.3
protected function get_default_primary_column_name() {
$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 ) {
if ( 'cb' === $col ) {
continue;
}
$column = $col;
break;
}
return $column;
}