Template Functions and Code Snippets

Template Functions

The Admin Columns API is a simple and standarized way for retrieving list table (incl. columns) configurations.

Function Description Code Snippet
ac_get_listscreen() Used to retrieve a single table configuration. See example
ac_get_listscreens() Used to retrieve a list of table configurations for a specific list table. See example
ac_get_column() Used to retrieve a single column and its settings. See example
ac_get_columns() Used to retrieve a list of columns and its settings. See example

Update the modified date after using inline edit for custom fields

By default, the Post Modified date will not be updated when you use inline edit for custom field related columns. This is because of the default behavior of WordPress that does not update a post when using the  update_post_meta . In Admin Columns we chose to leave this as it, but with the following snippet, you can update the post to update the post modified date.

View code snippet on GitHub


Allow another role to manage columns

By default, only administrators are allowed to manage columns. By adding this piece of code to your theme’s functions.php you will be able to allow users with another role to manage columns. In this example, we are adding the manage_admin_columns capability to the editor role.


Hooks: Action and Filters

Admin Columns has many WordPress PHP hooks that allow you to change the default behaviour and even extend it with new functionality. All filters and actions are listed here.

Still need help? Contact Us Contact Us