Sortable Admin Columns with Advanced Custom Fields ACF

Add Advanced Custom Fields ACF to your admin columns in WordPress and be able to sort them.

For this I will add a custom thumbnail and Event start date for an “Event” Custom post type.

First, you need two functions. One to create the columns, overriding what was default in WordPress and one to tell what each column to do.

It’s important to note that the structure of the add_action:  ‘manage_{YOUR_POSTTYPE}_posts_custom_column’
and the structure of the filter ‘manage_edit-{YOUR_POSTTYPE}_columns’

Then this final function to sort by Event Date:

Again, note the structure of the filter:
‘manage_edit-{YOUR_POSTTYPE}_event_sortable_columns’

Leave a Reply

Your email address will not be published. Required fields are marked *

66 + = 72