Code Snippets

These code snippets can be placed in your theme's functions.php file.


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