Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [wp-get-object-terms]

The tag has no usage guidance.

-1
votes
1answer
22 views

wp_get_current_user->user login returns %20 for spaces

I’m creating a custom form in CF7 and want to autocreate a link in the table to the users id via a shortcode plugin that does the business in CF7. It works fine when the user login has only one word. ...
1
vote
0answers
34 views

Get count of terms with a post and another taxonomy term?

How do I count the number of taxonomy terms which have both a) an associated post and b) where that post also has an associated term from another taxonomy? Specifically, I have... Custom post type "...
0
votes
0answers
14 views

Treat an object like an array to get a value

I'm trying to access the value of [product_id] with a foreach in the following object. I appreciate I can't treat it like an array but none of the answers I'm getting seems to work eg. $package = ...
0
votes
0answers
125 views

List all custom taxonomy terms related to another taxonomy

I want to list all custom taxonomy terms related to another taxonomy. For example the following case: Custom Post Type: Car Taxonomy 1: Brand ->Terms: Audi, Bentley, BMW, Bugatti, ... Taxonomy 2: ...
0
votes
2answers
132 views

How can I access string value in an array?

currently I am developing a site using the Dokan multivendor plugin. I added a custom field in the registration form and The below code is being used to add the custom field in the registration form ...
1
vote
1answer
22 views

Get Objects While Deleting term

I created a custom taxonomy organization for users and I could get specific organization user list by using get_objects_in_term($term_id, $taxnomy_name) functions. But, I can't use get_objects_in_term(...
0
votes
1answer
135 views

How to show terms used only for particular custom post type. Filter creation perpose

everyone. I have 10 custom post types and they are sharing 5 taxonomies. Right now I am working on the archive page template where I want to create ajax filters based on taxonomies for each of the ...
0
votes
1answer
56 views

Show Custom Taxonomy as Headline for related posts

I have a post with related posts. I do the relation with the Advanced Custom Fields Plugin. It works that I can show all the related posts of the term, but in addition I want to show only the name of ...
0
votes
1answer
2k views

How to display taxonomy term custom meta (using wp_get_object_terms?)?

I am attempting to feed term meta values from my custom taxonomy, "firm"/"firms", on to a User profile page at author.php. Users are attached to this taxonomy thanks to the LH User Taxonomy plugin. I ...
1
vote
1answer
558 views

Get post terms for multiple posts at once?

I know I can get the terms for a single post using wp_get_post_terms, but is there a way (without writing a loop) to get all the terms in use by an array of posts?
0
votes
2answers
2k views

How to apply comma separation,strip_tags and orderby to wp_get_object_terms

I have this... <?php echo strip_tags (get_the_term_list( $post->ID, 'school-year-level', ' ',', ')); ?> which nicely unlinks and comma separates a list of terms from a specified custom ...
-1
votes
2answers
1k views

Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta

I have a custom taxonomy associated with the WooCommerce product post type, which I have added to the woocommerce_sortable_taxonomies array so they can be ordered in the WordPress admin. The plugin ...
2
votes
1answer
199 views

Reduce / optimize calling of wp_get_object_terms() when generating permalinks

My theme runs a loop that does not require post terms to show. However Wordpress core runs the wp_get_object_terms function on every iteration. This results in unnecessary DB queries such as: ...
0
votes
1answer
4k views

Get child terms of current term of the current post

I have custom post type "product" and taxonomy is "product_cat". There are two child terms -Music and videos. Under Music i have two more child terms albums and single. Now when i go to music category ...
0
votes
1answer
256 views

Same taxonomy for different object types

Starting with WP 2.3 we can do this: register_taxonomy('custom_taxonomy', array('user', 'post', 'link', 'comment')); Those are different object types that belong to different tables and hence can ...
0
votes
1answer
532 views

Get a list of categories ids

I'm working on a portfolio with filters based on custom post type. That filters must display only categories for the posts that are displayed in the portfolio, since user can specify them by id in the ...
-1
votes
1answer
2k views

Display Categories Assigned to a WooCommerce Product

I am using WooCommerce with SuperStore theme. In meta.php file is this line, echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', $cat_count, '...
0
votes
2answers
892 views

Hide echo of no categories from get_object_taxonomies

The following code works perfectly to show all the categories for a custom post type. However when there are no categories it echos 'No Categories'. How would I remove this? &...
0
votes
2answers
904 views

Removing a taxonomy term

There is a Wordpress function called wp_remove_object_terms that unfortunatly doesn't seem to work. I am trying to achieve the same ends using the following $post_terms = wp_get_object_terms( $...
4
votes
1answer
428 views

wp_get_object_terms(): count relative to passed IDs?

I know when you wp_get_object_terms() you get a "count" member variable for each term object returned, but that "count" is what's in the $wpdb->term_taxonomy table in the database, it's not ...
1
vote
4answers
24k views

How to order the get_categories result

I read the documentation of the codex but i can't order the get_categories() result just like parent,childrens. I have these kind of categories' three: -Events - Music - Culture - ...
3
votes
3answers
3k views

Sort get_users by custom field

I have a custom USER taxonomy called 'label' which also has a custom field of 'sort_order' - I am trying to return a list of users that have the label taxonomy and then sort this list by the ...
1
vote
4answers
10k views

Order terms by term_order

Context Post Type: Resources Taxonomy: Media Type, Term: Audio Taxonomy: Series The following code displays a unique list of the custom taxonomy "Series" I want to order the list by term_order, but ...
0
votes
1answer
3k views

wp_get_post_terms Order by not working

wp_get_post_terms Order by not working My code is here query_posts(array('post_type' => 'product','post__in' => $product_ids,)); while (have_posts()) : the_post(); global $post; $args = ...
0
votes
2answers
646 views

Get object terms with no children?

Others have asked how to only get parent terms, but I need to get the deepest term for the post of a specific taxonomy. Is there a way I can only get terms where the number of children = 0?
4
votes
2answers
9k views

wp_get_object_terms() to get a list of all the terms attached to all the posts in the current query

How can I use wp_get_object_terms() to get a list of all the terms attached to all posts in the current query? For example, for the current query I want to get an array of the terms from the "Alfa" ...
0
votes
1answer
1k views

Deleting terms from the Wordpress wp terms table

what wp function do i use so that I can delete a term without worrying about the related tables such as wp term relationships and wp term taxonomy? Also if a post has a relationship to the deleted ...
0
votes
1answer
153 views

Modify my code - which takes the first sentence of the post and use it as a h2 tag - to work outside the loop

My code takes the first sentence of a post and places it's content inside a variable. The problem is it works only inside the loop. I need help making this code outside the loop, becouse I want to ...
13
votes
7answers
49k views

Get the the top-level parent of a custom taxonomy term

How would I get the top-level parent of a given term? I am using wp_get_object_terms to get taxonomy terms on posts, but instead of showing all tagged terms, I only want to show tagged terms' top-...
0
votes
1answer
4k views

Proper use of wp_get_object_terms

Summary: How can I get the name and the permalink of the object returned by wp_get_object_terms()? Detailled: I created a custom post type called "ge_zielgruppe" and a taxonomy called "...
3
votes
2answers
3k views

wp_get_object_terms - How can I order the resulting array by hierarchy?

I'm returning a custom hierarchal taxonomy via wp_get_object_terms. The trouble is that the results are being ordered by name or count, neither of which are proving reliable. (I'm using a custom ...
0
votes
1answer
1k views

Why does wp_get_object_terms add a period after terms are output?

I'm using the following line to output an unordered list of taxonomies and their associated terms for a custom post type. The only problem with it is that a period gets added after the term. ...