Articles of wp set object terms

Update Custom Post Custom Taxonomy Term from front end form

I can’t update my post custom taxonomy term using my front end form. The headers shows me 200 Ok status but the update post function is not working. I’ve been using: wp_set_object_terms and wp_set_post_terms in an attempt to make it work. I did a little research here and I found some information but haven’t been […]

wp_set_object_terms not accepting variable array

I am trying to use the following command: wp_set_object_terms( $myID, $myissuearray, ‘my_issues’, true ); But for some reason, it won’t accept my variable array. That array, $myissuearray, using error_log(print_r($myissuearray,true)) outputs: Array ( [0] => 9 [1] => 10 [2] => 77 [3] => 12 ) Which sure looks like a valid array to me. If […]

Dynamically set taxonomy term and show admin notice on post save

I have a taxonomy of “date” listing all months of the year. And I have a custom field of “start_date”. I would like to update the ‘date’ taxonomy dynamically so the user doesnt need to click both when setting up a post. So far my efforts have not shown results. What am I doing wrong? […]

Saving custom hierarchical taxonomy terms using wp_set_object_terms for custom user profile fields

I have created custom user profile fields, using custom taxonomies. My custom taxonomy name is my-category. The parent terms are Gender and Privacy. Their Childs terms are Male, Female and Yes, No: Gender -> (Male, Female) Privacy -> (Yes, No) Here is what happens when i press the update user button: //Function to store the […]

wp_set_post_terms struggle :(

I have trying to find that one without luck for a while therefore I come to you. when I try to insert a term as custom taxonomy it doesn t work completely. If I write this wp_set_object_terms( $post_id, $county, ‘kommun’); basically I don t think it completely works as I can see the term when […]

How to update terms into database from specific taxonomy without plugin?

I am trying to update terms order in database TERMS TABLE TERM TAXONOMY TABLE TERM RELATIONSHIPS TABLE I want to sort order like highlight numbers. I am trying this query but not works for me. global $wpdb; $wpdb->query(“UPDATE wpl_term_relationships SET term_order=$counter WHERE term_taxonomy_id IN (SELECT term_taxonomy_id FROM `wpl_term_taxonomy` WHERE taxonomy = ‘product_tag’) “);

Saving Child Terms on front end not setting parent

I recently had a issue where I was trying to save the child terms on a front end post form. ORIGINAL POST AND CODE I thought I had it good to go but now I just realize it’s not setting the parent term as well, just the child term. $nhb_type_value = $_POST[‘nhb’]; $nhb_type = wp_get_object_terms($Property_Id, […]

wp_set_object_terms – Multiple values seperated by a comma

I’m currently trying to set 2 custom terms from a an API result, but I end up with 1 long term with a comma in between. $data = ‘term1, term2’; wp_set_object_terms($post_id, $data , ‘mytaxonomy’, false); I get one term named “term1, term2”, but what I want to do is set each term separately, any ideas? […]

wp_set_object_terms timing out?

I have a list of 350 or so terms that I am trying to set to a post. Here’s my code: add_action(‘init’, ‘add_cities_to_story’); function add_cities_to_story() { $cities_list = get_term_children(‘115’, ‘location’); // MA wp_set_object_terms(‘632’, $cities_list, ‘location’); } The trouble is that it appears to timeout about 3/4 of the way through the list. Also, any ideas […]

Improving Co-Authors Plus Plugin

I’ve been using the Co-Authors Plus plugin for assigning multiple authors to posts. The authors are very particular in the ordering of the names on the public-facing side of the website so I need the ability to arbitrarily order the authors. It turns out it’s not that hard using a line of jQuery to make […]