Search by type posts and taxonomy

You can add a custom tax_query to your filter, and pass the search query to it: function searchfilter($query) { if ($query->is_search && !is_admin() ) { $s = $query->get( ‘s’ ); $query->set(‘post_type’, [ ‘lesson’, ‘series’ ] ); $query->set( ‘tax_query’, [ [ ‘taxonomy’ => ‘your-taxonomy’, ‘field’ => ‘name’, ‘terms’ => $s , ] ] ); } return … Read more

Get Bottom Most Level Taxonomy Terms?

Here is the solution I ended up with. This may help others too. $taxonomy = “product-category”; $args = array( ‘taxonomy’ => $taxonomy, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hierarchical’ => true, ‘hide_empty’ => false, ); $the_query = new WP_Term_Query($args); $categories = $the_query->get_terms(); if ($categories){ foreach($categories as $category){ $ancestors = get_ancestors( $category->term_id, $taxonomy ); $category->ancestors = … Read more

Taxonomy page template changing when using query variables

The problem is that category_name is a reserved keyword for the built-in categories for posts. Almost anything category_* is reserved. You can find a list of reserved keywords at the following url: https://codex.wordpress.org/Reserved_Terms This includes, but is not limited to: cat category category__and category__in category__not_in category_name term terms Behind the scenes it sees that you’re … Read more

Custom Taxonomy list: how to make “choose from most used” default to open, checklist

The default UI view for a hierarchical custom taxonomy is a series of checkboxes. It sounds like wine taxonomies have a one-to-many relationship so you should be set. If you are registering your taxonomy using PHP add hierarchical => true to your configuration options. register_taxonomy( ‘xxx’, ‘post’, array( … **’hierarchical’ => true** , …) ); … Read more