WordPress built-in method to extract array of term IDs?

I’m querying a custom taxonomy for a post, hoping to get a list of all terms for that post and taxonomy. get_the_terms($post_id, $taxonomy) works, but gives this ungodly array of term objects that will require an extra layer of parsing before I can run the following code: if (in_array($list_of_term_ids, $my_term_id)){ do good stuff… } I’m … Read more

How to get all attributes with their terms related to specific Woocommerce product category [closed]

Closed. This question is off-topic. It is not currently accepting answers. Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third party plugins and themes are off topic, they are better asked about at their developers’ support routes. Closed 3 … Read more

How to change / delete product short description in Woocommerce

How to change / delete product short description in Woocommerce I use $short_desc = $post->post_excerpt; to read the property but I cant change it with wp_set_object_terms($post->ID, $post->post_excerpt, ‘new excerpt’); 2 Answers 2 Th function wp_set_object_terms() will not work to set post object properties. To add/update/delete product short description there is mainly 2 ways: 1) the … Read more

Is it possible to get a Previous/Next Taxonomy term archive URL?

I have a custom post type called shows and taxonomy called podcast. Using taxonomy-podcast.php, I having hard time finding a function that will generate next/previous Term URL Archive. For Example: URL: url.com/podcast/example-term-2 Example Term 2 post 1,post 2,post 3 Desired output < Previous Term(url.com/podcast/example-term-1) . . . . . | . . . . . … Read more

Check if term object is in array

I want to check if a term object is in an get_terms array, but i really can’t figure out how to do it. $subcat_terms = get_terms([ ‘taxonomy’ => ‘product_cat’ ]); $subcat_terms generates an array like this: array (size=3) 0 => object(WP_Term)[10551] public ‘term_id’ => int 16 public ‘name’ => string ‘Hardware’ (length=8) public ‘slug’ => … Read more

Adding active/current class to get_terms list

I have a list of terms I’m displaying using “get_terms”. Each term is linked so if the user clicks it, they go to the term archive page. <?php $terms = get_terms(‘category’);t echo ‘<ul>’; foreach ($terms as $term) { echo ‘<li><a href=”‘.get_term_link($term).'”>’.$term->name.'</a></li>’; } echo ‘</ul>’; ?> However, I would like to know if there’s a way … Read more

Term begins with a letter

I had a template that relied on $terms = get_terms( “ingredient”, array( ‘name__like’ => $letter ) ); to return all posts where the custom taxonomy ingredient begins with $letter. The behaviour of name__like was changed in WP 3.7 to a text search instead of beginning. What function can I use to achieve the results I … Read more