Skip to content

Instantly share code, notes, and snippets.

@secretstache
Created April 8, 2015 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secretstache/fe11521765e991131995 to your computer and use it in GitHub Desktop.
Save secretstache/fe11521765e991131995 to your computer and use it in GitHub Desktop.
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