Articles of wp get object terms

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 i want to get all the child terms of the music. I am using the following code <?php $page_id […]

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 have same primary key ID. Now if we take a look at the functions used to get or check terms, they all lack object_type parameter. is_object_in_term( $object_id, $taxonomy, $terms […]

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 need to display term meta fields for the firm to which s/he belongs. So far, I have managed to find […]

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 “ge_zielgruppe_taxonomy”. The latter can be attached to posts and to “ge_zielgruppe” post types. On the single page of “ge_zielgruppe” I want to show the last few […]

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 = array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘fields’ => ‘all’); $product_terms = wp_get_object_terms($post->ID, ‘productcategory’,$args); if(!empty($product_terms)){ if(!is_wp_error( $product_terms )){ echo ‘<ul>’; foreach($product_terms as $term){ echo ‘<li><a href=”‘.get_term_link($term->slug, ‘product’).'”>’.$term->name.'</a></li>’; } echo ‘</ul>’; } } endwhile; I […]

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 taxonomy (school-year-level). However the list isn’t in the order I want. I’ve hunted down this… http://codex.wordpress.org/Function_Reference/wp_get_object_terms <?php $product_terms = wp_get_object_terms( $post->ID, ‘school-year-level’, $args ); $args = array(‘orderby’ => […]

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. wp_get_object_terms( $id, the_taxonomies( ‘before=<ul><li>&sep=</li><li>&after=</li></ul>’ ) ); Here’s what it outputs: <ul><li>Taxname: <a href=’http://site.com/taxname/taxterm/’>Taxterm</a>.</li></ul> Is there an argument I can add […]

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 relative to the IDs you pass in as the first parameter. How do I get that number, though? Example, something like: $query = new WP_Query(array(‘post_type’ […]

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?

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 it is not working. Any suggestions? The site. Currently it’s ordered by ID <?php $post_data = array(); $my_query = new WP_Query( array( ‘post_type’ […]