How to update custom taxonomy meta using ACF update_field() function or any other wordpress function - WordPress Development Stack Exchange

EMBED

Tue Oct 26 2021 20:59:14 GMT+0000 (Coordinated Universal Time)

Saved by @richard


I figured it out somehow.. Syntax of update_field(): update_field($field_key, $value, $post_id) MY MISTAKE: I was using the wrong parameter for the $post_id which i thought was the Term Id of the custom taxonomy term. CORRECT USAGE: rather than using term id ($term_id in my question), one should use a string with the taxonomy preppended to the $term_id ie $post_id = $taxonomy.'_'.$term_id for eg: if your custom taxonomy is foo and the term id is 123 then : $post_id = foo_123 Hope this is helpful for someone. This is the first time I'm asking/answering a question here.

https://wordpress.stackexchange.com/questions/213354/how-to-update-custom-taxonomy-meta-using-acf-update-field-function-or-any-othe