Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Append ACF Post Object to Admin Column Pro Filter Dropdown
<?php
/**
* Filter the Admin Column results
*
*/
function my_cac_filtering_options_change_acf_label( $options, $column ) {
$column_type = 'column-acf_field'; // enter type of field. You can find this by hovering of the Type label of the column settings.
$field_label = 'Product Class'; // enter label of the ACF field.
//if ( $column_type == $column->get_type() && $acf_field_type == $column->get_field_type() ) {
if ( $column_type == $column->get_type() ) {
$field = $column->get_field();
if ( $field_label == $field['label'] ) {
foreach ( $options as $key => $label ) {
$industry_id = get_field('industry', $key);
$industry = get_the_title($industry_id);
$options[ $key ] = $label . ' &mdash; ' . $industry;
}
}
}
return $options;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.