WP_List_Table::get_default_primary_column_name() WordPress Method

The WP_List_Table::get_default_primary_column_name() method is used to get the default primary column name for a list table.

WP_List_Table::get_default_primary_column_name() #

Gets the name of the default primary column.


Return

(string) Name of the default primary column, in this case, an empty string.


Top ↑

Source

File: wp-admin/includes/class-wp-list-table.php

1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
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;
}


Top ↑

Changelog

Changelog
VersionDescription
4.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.