how to echo a custom taxonomy term from an array of term

You’re checking if a product_type has a term using has_term(). Now you need to actually get the terms using get_terms(). That function can technically return from 1 to 4 terms. If more than one of the terms is set, you’ll need to pick one. In the following code, I chose the first since there’s guaranteed … Read more

“If an object equals a term id then return the term name”

Great googly moogly, I figured this one out. $values = get_post_meta( get_the_ID(), ‘your_meta_whatever’, true ); foreach ($values as $value) {$term = get_term_by(‘term_id’, $value, ‘your taxonomy’); $name = $term->name echo $name;} If you want to keep ’em separated by commas or the characters your choice $values = get_post_meta( get_the_ID(), ‘your_meta_whatever’, true ); $total = count($values);$i=0; foreach … Read more

taxonomy_edit_form_fields output after term fields

Got it! It seems this action is fired within a table element. Removing the _fields part seems to have done the trick as this refers to an action fired later in the page, after the table. $term_filter_name_edit = $type . ‘_edit_form’; add_action($term_filter_name_edit, ‘box_term’, 1000, 1 ); function box_term() { echo ‘Test output’; } Reference: https://github.com/WordPress/WordPress/blob/master/wp-admin/edit-tag-form.php

How to exclude post-tag taxonomy for a custom post type?

Try this to unregister the post_tag taxonomy from the Custom Post Type. function wpdocs_unregister_tags_for_posts() { unregister_taxonomy_for_object_type( ‘post_tag’, ‘post’ ); } add_action( ‘init’, ‘wpdocs_unregister_tags_for_posts’ ); Update the ‘post’ to your custom post type. Docs: https://developer.wordpress.org/reference/functions/unregister_taxonomy_for_object_type/ Also, you’ve defined the following twice in your $args ‘taxonomies’ => array(‘product’), ‘taxonomies’ => array(),

echo a tax term in loop

I think you want to get the term link of the of each post. I will explain how you should get the answer for this. First you will need get the term object of current post. Support your taxonomy name is ‘your_taxonomy’; $terms = get_the_terms( $post_id, ‘your_taxonomy’ ); Because $term here is an array, in … Read more

Translation ready code format for taxonomy

_x( ‘Categories’, ‘taxonomy general name’ ) does it make taxonomy general name a text domain? wont it resulting in multiple translation? That taxonomy general name is the gettext or translation context used in the POT file. The text domain is the third parameter, which defaults to default. From the Codex: Sometimes a single term is … Read more

WordPress get parent category taxonomy

Sounds weird, but can you check if this code works: $terms = get_the_terms( $post->ID, ‘service’ ); if ( $terms ) { foreach ( $terms as $term ) { $colour_scheme = get_field( ‘colour_scheme’, $term ); $svg_image = get_field( ‘svg_image’, $term ); // we check if the term is top-level term, in which case it does not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)