Tag Info

New answers tagged

0

To get the attached term IDs, use get_the_terms() and wp_list_pluck(): if ( $terms = get_the_terms( $post, 'director' ) ) { $term_ids = wp_list_pluck( $terms, 'term_id' ); }


0

$_POST['tax_input[genres]'] should be $_POST['tax_input']['genres']


0

Solved the issue by passing the term_name as a parameter to the callback function to the filter. function bn_term_title( $term_name ) { $term_types = get_term_by( 'name', $term_name, 'tax_1' ); if( $term_types->taxonomy === 'tax_1' ) { if( get_locale() === 'bn_BD' ) return get_term_meta( $term_types->term_id, 'tax1_bn' ); ...


0

I think, you are looking for this //to get all the terms for current post - $terms = get_the_terms( $post->ID, 'tapahtumat' ); //get description of each term foreach ( $terms as $term ) { echo term_description( $term->term_id, 'tapahtumat' ); }


2

You are fetching all the terms of your taxonomy, Use this instead : $terms = wp_get_post_terms(get_the_ID(), 'city-type'); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { echo '<span>' . $term->name . '</span>'; } } Note : First argument to the function is id of the ...


0

Each term object has a parent attribute which is set to 0 in case it's a parent root term or the ID of the parent in case it is a child term. So, if you have only one level of child terms then you can check for that attribute to not be equal to 0 in which case the term has a parent. $object_terms = wp_get_object_terms( $post->ID, 'types', array( 'fields' ...


0

Have just tweaked your code to achieve what you need. See, if this works for you - $taxonomyName = "age"; $parent_terms = get_terms($taxonomyName, array('parent' => 0, 'orderby' => 'slug', 'hide_empty' => false)); echo '<ul>'; foreach ($parent_terms as $pterm) { $terms = get_terms($taxonomyName, array('parent' => $pterm->term_id, ...


2

There is no tax_query parameter for the WP_User_Query class. Since you've tagged the question with user-meta I can only assume you store the ID (or even the term name itself?) of a particular shop-category term as a user meta entry. In this case you would need something like this: // The 'WP_User_Query' arguments array $args = array( 'role' ...



Top 50 recent answers are included