Columns
To modify a post types admin columns use the column()
manager. It has a variety of methods to help fine tune admin table columns.
Add Columns
To add columns to the admin edit screen pass an array of column slugs and labels to the add()
method.
Hide Columns
To hide columns pass the column slug to the hide()
method. For multiple columns pass an array of column slugs.
Column Order
To rearrange columns pass an array of column slugs and position to the order()
method. Only columns you want to reorder need to be set, not all columns. Positions are based on a zero based index.
Set Columns
To set all columns to display pass an array of the column slugs and labels to the set()
method. This overrides any other configuration set by the methods above.
Populate Columns
To populate any column use the populate()
method, by passing the column slug and a callback function.
Sortable Columns
To define which custom columns are sortable use the sortable()
method. This method accepts an array of column slugs and an array of sorting options.
The first option is the meta_key
to sort the columns by.
The second option is how the items are ordered, either numerically (true
) or alphabetically (false
) by default.
Last updated