WordPress REST get all items without a taxonomy assigned

I was able to solve the problem by adding a custom route. Although i had to do the same process in php by first querying all available terms of the type and then exclude them from the query. $available_terms = array_map( function ( $term ) { return $term->term_id; }, get_terms( ‘lagerboxen_kategorie’ ) ); return get_posts( … Read more

Paginate_links won’t create the right links on a taxonomy filtered custom post type archive

If, for example, I click on the “2”, the page loaded as removed my taxonomy filter(s) and paginate navigation “max-page” looks like (seems to be) the number of pages non filtered by taxonomy It’s not that the (taxonomy) filters are removed from the pagination links, but instead, the filters are actually never added because the … Read more

Archive pages for posts based on their taxonomy?

The Template Hierarchy Codex entry is your friend. Archive page for category hair: category-hair.php Archive page for taxonomy shampoo: taxonomy-shampoo.php Archive page for taxonomy shampoo term dry: taxonomy-shampoo-dry.php To display some cross-query between different taxonomies, such as category and a custom taxonomy, such as hair, you’ll need to do a custom query, and display it … Read more

Conditional tag affecting taxonomy term and its children?

I have a handy little function that i based on post_is_in_descendant_category function it expends the is_tax to check if its the term or any of his children function is_or_descendant_tax( $terms,$taxonomy){ if (is_tax($taxonomy, $terms)){ return true; } foreach ( (array) $terms as $term ) { // get_term_children() accepts integer ID only $descendants = get_term_children( (int) $term, … Read more

Getting 404 on taxonomy page

I’ve solved this for myself with rewrite rule. The story: I have “piece” custom post type, taxonomy “media_tag” with “m_audio” term and taxonomy “genre_tag” with “g_sacred”, “g_folk” etc. And I want to have an URL like /piece/audio/<genre> to access archives. So, now I have in my functions.php: add_filter( ‘rewrite_rules_array’, ‘my_insert_rewrite_rules’ ); function my_insert_rewrite_rules( $rules ) … Read more

Get current custom user taxonomy

Try this suggestion: $user_id = get_current_user_id(); // Get current user Id $user_groups = wp_get_object_terms($user_id, ‘user-group’, array(‘fields’ => ‘all_with_object_id’)); // Get user group detail foreach($user_groups as $user_gro) { echo $user_gro->name; // Get current user group name echo $user_gro->taxonomy; // get current user taxonomy }