Skip to content

Instantly share code, notes, and snippets.

@wpserve
Created March 10, 2022 16:12
Show Gist options
  • Save wpserve/0634299bcc67d03bef77119dd20c86e7 to your computer and use it in GitHub Desktop.
Save wpserve/0634299bcc67d03bef77119dd20c86e7 to your computer and use it in GitHub Desktop.
ACF Title instead of term ids
<?php
add_filter('wpc_filter_post_meta_term_name', 'wpc_acf_tax_term_name', 10, 2);
function wpc_acf_tax_term_name($term_name, $e_name)
{ // tax_object - is a filter meta key name.
if( $e_name === 'tax_object' ){
$term = get_term( $term_name, 'product_cat' ); // product_cat is related taxonomy
$term_name = $term->name;
}
return $term_name;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment