Title: WP_List_Table::get_default_primary_column_name
Published: August 18, 2015
Last modified: May 20, 2026

---

# WP_List_Table::get_default_primary_column_name(): string

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#wp--skip-link--target)

Gets the name of the default primary column.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#return)󠁿

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

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#source)󠁿

    ```php
    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;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-list-table.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/class-wp-list-table.php#L1218)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/class-wp-list-table.php#L1218-L1240)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_List_Table::get_columns()](https://developer.wordpress.org/reference/classes/wp_list_table/get_columns/)`wp-admin/includes/class-wp-list-table.php` |

Gets a list of columns.

  |

| Used by | Description | 
| [WP_List_Table::get_primary_column_name()](https://developer.wordpress.org/reference/classes/wp_list_table/get_primary_column_name/)`wp-admin/includes/class-wp-list-table.php` |

Gets the name of the primary column.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_list_table/get_default_primary_column_name/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_list_table%2Fget_default_primary_column_name%2F)
before being able to contribute a note or feedback.