How to get all taxonomies which can be added in menu?

The taxonomies visible in the admin menu are exactly those taxonomies that were registered with show_in_menu = true and show_ui = true. For a reference on this, see the documentation on register_taxonomy, the function for adding (custom) taxonomies. To query these taxonomies, use the corresponding parameters in get_taxonomies: get_taxonomies( array( ‘show_ui’ => true, ‘show_in_menu’ => … Read more

Add category only if post has custom taxonomy category

wp_get_post_terms( $post_id, $taxonomy, $args ) expects third param to be an array of arguments. Params $post_id (integer) (optional) The Post ID Default: 0 $taxonomy (string|array) (optional) The taxonomy for which to retrieve terms. Defaults to post_tag. Default: ‘post_tag’ $args (array) (optional) Overwrite the defaults Default: array My guess is that $old_term is being set to … Read more

How to edit this code to get the categories in achieve page?

first thing that i notice, is that you use some obscure WP loop markup foreach( $myposts as $post ) : setup_postdata($post); Please loop with standard markup an WP_Query class <?php $query = new WP_Query( $args ); ?> <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?> https://codex.wordpress.org/The_Loop Next thing, that is … Read more

Custom sub taxonomy order by

It’s a little bit hard to say what exactly was the point of your code… First problem that I can see is that you’re misusing get_term_by function. This function takes 5 params: get_term_by( $field, $value, $taxonomy, $output, $filter ) $field (string) (required) Either ‘id’, ‘slug’, ‘name’, or ‘term_taxonomy_id’ $value (string|integer) (required) Search for this term … Read more

How do I display the grand child items of a taxonomy term?

I managed to answer this question myself by adding get_queried_object()->term_id; instead of the taxonomy terms ID. It now outputs all the grandchild taxonomy terms for the current taxonomy term. Here is my updated working code: $term_id = get_queried_object()->term_id; $taxonomy_name=”product_range”; $term_children = get_term_children( $term_id, $taxonomy_name ); echo ‘<ul>’; foreach ( $term_children as $child ) { $term … Read more