apply_filters( 'list_table_primary_column', string $default , string $context )
Filters the name of the primary column for the current list table.
Parameters
-
$default
string -
Column name default for the specific list table, e.g.
'name'
. -
$context
string -
Screen ID for specific list table, e.g.
'plugins'
.
Source
File: wp-admin/includes/class-wp-list-table.php
.
View all references
$column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
Changelog
Version | Description |
---|---|
4.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
A simple example for Users table and CPT table
For further management of columns, check:
https://developer.wordpress.org/reference/hooks/manage_post_type_posts_columns/
To add/remove/rename columns
https://developer.wordpress.org/reference/hooks/manage_post-post_type_posts_custom_column/
To set the custom column values
If you’re adding a column in the first position, it’s important to set this column as primary because WordPress has CSS rules that are applied for columns after the primary column. Otherwise, the list table can render with some layout issues.
Example of CSS rule used by WordPress:
.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-primary~td:not(.check-column)