Created
March 10, 2022 16:12
-
-
Save wpserve/0634299bcc67d03bef77119dd20c86e7 to your computer and use it in GitHub Desktop.
ACF Title instead of term ids
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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