Articles of wp set object terms

How to relate a user object to taxonomy term?

I am attempting to import several users, who each should have a connection with a term in a taxonomy named “firm” – but I don’t know how to make the connection… Background: FYI, I have already enabled WordPress taxonomy support for Users using plugin LH User Taxonomies, and taxonomy “firm” has already been registered. I […]

Adding action to save_post, post needs to be saved twice for function to work

I have written the following function which copies all post terms from the “tribe_events_cat” taxonomy to the “categoria” taxonomy when the post is saved. There is a bug where in order for the terms to be copied, I need to click “update” twice (i.e. save the post twice). I believe this happens because when I […]

What is the action hook that deletes a taxonomy term from the backend? And how to retireve the term id before deleting it?

I need to delete some postmeta when deleting taxonomy terms from the backend. Before deleting the term, I need to retrieve the postmeta’s meka_key and the term id that is going to be deleted. Use the term id to perform some tasks and then delete the postmeta and term. I already tried using the action […]

WordPress object for comments frame

For two days I have tried to make this code work. I want to add a comment frame in single.php. I got this code to put it in the single page’s template: <script type=”text/javascript” charset=”utf­-8″> initFrame({ app_id: ‘xxx’ , object_id: ‘ARTICLE_ID’ , object_title: ‘ARTICLE_TITLE’ , object_content: ‘ARTICLE_CONTENT’ , object_url: ‘ARTICLE_URL’ , arguments_container: ‘comment’ , width: […]

wp_set_object_terms not working inside loop

I have the following code $genres= array(‘action’, ‘comedy’, ‘horror’); foreach($genres as $genre){ $ret = wp_set_object_terms( $postId, $genre, ‘genres’); } But this code associates only horror as the genre. When I checked the DB too, I don’t have a record for action and comedy. How do I associate all the three with my genre? Thanks in […]

merging terms programmatically while maintaining the count

This question is all about finding out the best way to handle merging similar terms. Let’s say you have 10 posts tagged as Barack Obama and 20 posts tagged as Obama. and you want to group them all under Barack Obama and get 30 posts for it and get rid of the tag Obama. Surely, […]

How to add terms (without deleting others)

I have a form on my site that allows signed in users tag products from the front-end of the site in a basic form. I am using Woocommerce as the commerce platform. Woocommerce uses Custom Post Types to register its products. Product tags is a taxonomy (product_tag) Woocommerce uses for tagging products. I am using […]

wp_set_object terms won't remove all terms

I am trying to figure out why wp_set_object terms will update the terms in a given taxonomy but when I set the $terms param to NULL it keeps one of the terms – the one with the lowest ID. I’ve altered a plugin for frontend editing of posts – WP User FrontEnd. Here’s my wp_set_object_terms […]

Programmatically add posts add and assign postmeta and assign terms

I have thousands of WooCommerce products that need to be inserted into the database. For some reasons I can’t use the csv import plugin or any other 3rd party solution and this has to be done manually through php code into database. Here is what my question is: To what table do the product categories […]

Extend Walker Class for 2 checkbox taxonomy selection?

I am working on an add-content front end form (posts in this case). I am able to display, and add, categories and taxonomies to posts correctly with the following: <div class=”checkbox”> <?php wp_terms_checklist( 0, array( ‘taxonomy’ => ‘category’, ) ); ?> </div> <div class=”checkbox”> <?php wp_terms_checklist( 0, array( ‘taxonomy’ => ‘city’, ) ); ?> </div> […]