Tag Info

New answers tagged

0

I find out the problem and the solution. I debugged the "wp_set_object_terms" by using "is_wp_error" and I got "Invalid Taxonomy" message, then I realized that when the posts was being created that term didn't exists. So I change the hook to "init" in the programmatically_create_post() function, and voila! Below this line the code working: <?php // ...


0

Here is an example. I've tried to explain each process happening in each line. I hope this code can easily explain you how this is working. <?php //creating a blank array to store the inserted terms ids $terms = array(); //inserting the term "Kathmandu" in a custom taxonomy "region" $tax_insert_id = wp_insert_term('Kathmandu','region' ); //if the term ...



Top 50 recent answers are included