Retrieve single term slug

Thank you guys for such quick response. Much appreciated! Here is code for “global” Tags page (displaying terms of default ‘post_tag’ taxonomy): <?php $term_slug = get_queried_object()->slug; if ( !$term_slug ) return; else $loop = new WP_Query( array( ‘post_type’ => ‘any’, ‘tag’ => $term_slug, ‘posts_per_page’ => 10 ) ); while ( $loop->have_posts() ) : $loop->the_post(); ?> … Read more

get_terms() How many is TOO many?

Ad slowing down) Lame answer: depends on your server and stuff. Ad possible bug) wp_count_terms(); is a level “above” get_terms(); and therefore has values like ‘hide_empty’ and ‘fields’ already set. I’d say: diff your $args against those predefinied by wp_count_term();. The later function does nothing than calling the get_terms() at it’s end.

Taxonomy slug by term ID

For a menu object $item: $item->object stores the object the menu item refers to, e.g. ‘post’, ‘page’, ‘my-cpt’, or ‘my-taxonomy’ (the post type name, or the taxonomy name) $item->type stores what ‘type’ of object is it, either: ‘post_type’ or ‘taxonomy’. For custom links, these are both custom

Insert new term during new post creation

first you should set the taxnomy in custom post type you have just set only for post title post content post comments you did not set for custom taxnomy $post = array(‘tax_input’ => [ array( <taxonomy> => <array | string> ) ] // For custom taxonomies. Default empty. ‘page_template’ => [ <string> ] // Requires … Read more