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

---

# WP_List_Table::get_primary_column_name(): string

## In this article

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

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

Gets the name of the primary column.

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

 string The name of the primary column.

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

    ```php
    protected function get_primary_column_name() {
    	$columns = get_column_headers( $this->screen );
    	$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 = self::get_default_primary_column_name();
    	}

    	/**
    	 * Filters the name of the primary column for the current list table.
    	 *
    	 * @since 4.3.0
    	 *
    	 * @param string $default Column name default for the specific list table, e.g. 'name'.
    	 * @param string $context Screen ID for specific list table, e.g. 'plugins'.
    	 */
    	$column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );

    	if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
    		$column = $default;
    	}

    	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#L1262)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/class-wp-list-table.php#L1262-L1289)

## 󠀁[Hooks](https://developer.wordpress.org/reference/classes/wp_list_table/get_primary_column_name/?output_format=md#hooks)󠁿

 [apply_filters( ‘list_table_primary_column’, string $default, string $context )](https://developer.wordpress.org/reference/hooks/list_table_primary_column/)

Filters the name of the primary column for the current list table.

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

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

Gets the name of the default primary column.

  | 
| [get_column_headers()](https://developer.wordpress.org/reference/functions/get_column_headers/)`wp-admin/includes/screen.php` |

Get the column headers for a screen

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_list_table/get_primary_column_name/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_list_table/get_primary_column_name/?output_format=md#)

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

Gets the name of the primary column.

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

Gets a list of all, hidden, and sortable columns, with filter applied.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_list_table/get_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_primary_column_name%2F)
before being able to contribute a note or feedback.