Thursday, August 11, 2022
HomeWordPress Developmentphp - wp_set_post_terms does not enable to manually add new phrases

php – wp_set_post_terms does not enable to manually add new phrases


So I am making a operate which based mostly on the chosen class for the put up, it robotically provides phrases (tags alike) to that put up.
It really works advantageous, the issue is now the put up has these phrases and if I manually add one from the wp backend and save the put up, the put up phrases assigned revert to these programmatically set with wp_set_post_terms.

Is not there a operate for phrases just like wp_add_post_tags ? to ADD and never SET phrases? or how do I obtain that?

my code now, which is totally ineffective to connect however I get flagged and swatted if I do not, right here it’s:

...
if (has_term("MyCategory", $c_name, $put up){
  wp_set_post_terms($post_id, $arrayOfTerms, 'my_taxonomy_id', true);
}
...

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments