Home › Forums › General Issues › How to use WP Term Meta, the easy way! › Reply To: How to use WP Term Meta, the easy way!
Good idea to automate! I just would use “termmeta_” as the prefix, makes it more reliable to avoid mistakes and put the filter after check field name.
function ...( $value, $post_id, $field ) {
if( strpos( $field['name'], 'termmeta_' ) === 0 ) {
$term_id = intval( filter_var( $post_id, FILTER_SANITIZE_NUMBER_INT ) );
if( $term_id > 0 )
[...]
}
return $value;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.