Add Sortable ACF Custom Field to Admin Column

PHOTO EMBED

Thu Feb 04 2021 20:47:06 GMT+0000 (Coordinated Universal Time)

Saved by @shm1ckle #php

add_filter('manage_events_posts_columns', 'filter_events_custom_columns');
function filter_events_custom_columns($columns) {
    $columns['event_date'] = 'Event Date';
	unset($columns['date']);
    return $columns;
}
add_action('manage_events_posts_custom_column',  'action_events_custom_columns');
function action_events_custom_columns($column) {
	global $post;
	if($column == 'event_date') {
		echo(get_field('event_date', $post->ID));
	}
}
add_filter( 'manage_edit-events_sortable_columns', 'sortable_events_custom_columns' );
function sortable_events_custom_columns( $columns ) {
    $columns['event_date'] = 'Event Date';
    //To make a column 'un-sortable' remove it from the array
    //unset($columns['date']);
    return $columns;
}
content_copyCOPY