AC\Column class contains the properties, options, and methods of a column.
There are two main scenarios where you might want to use AC\Column:
If you have been using a filter or action to hook into Admin Columns and one of the callback values is a column object. Or when you have created a new column yourself and have extended on
The class is located at
/admin-columns/classes/Column.php and can be viewed on github. Please read over the extended comments found above each function to learn more.
Method and properties
Returns the column name. The `Name` is a unique identifier that is assigned when the Column has been stored in the database. e.g.
The Column Name can be found on the columns settings page by opening screen options (in the top-right corner) and then enabling Column Name.
Returns the column type. The `Type` is a hard-coded identifier for each type of column. There are many types of columns, each with its own type. e.g.
The Column Type can be found on the columns settings page by opening screen options (in the top-right corner) and then enabling Column Type.
Returns the hard-coded label for the column. e.g. Featured Image, Custom Field, Slug
get_option( $name )
Returns a column option set by the user.
Returns the custom set column header label e.g. My custom Label
Returns an array with the width and width_unit of the column.
[ 'width' => 200, 'width_unit' => 'px' ]
Returns the meta_key for a Custom Field column. e.g.
Returns the type of field for a Custom Field column. e.g.
array with all column options set by the user.
Returns the post type name of a column when available. e.g.
Returns the taxonomy name of a column when available. e.g.
get_value( $id )
int) is the Post/Comment/User/Term ID. e.g.
Returns the column value that is displayed in the column cell as a
<a href="/post/2146">My Value</a>
get_raw_value( $id )
Returns the raw column value (used by sorting and inline edit ) as an
string. For example, it will return the name of the author without any HTML markup, such as the author link.
Determines if a column should be made available for a specific WordPress list table. Returns
In this example on GitHub, we created a Page Template column that is only available to specific post types which support page templates.
true when the column is not added by Admin Columns. It probably is defined in WordPress core, another plugin or theme. Examples of original columns are the Title, Date or Author column.
Learn more about the AC\ListScreen object.