Advanced Tax Query
Try [operator] => AND in both the sub-arrays. I think that will work from my reading of WP_Tax_Query::get_sql().
Try [operator] => AND in both the sub-arrays. I think that will work from my reading of WP_Tax_Query::get_sql().
The API responses are designed to only return the IDs. You can then fetch the full information for each term. Of course it would not be very performant to make dozens of requests. So instead, the REST API has the concept of embedding resources. If you make your request, but include _embed=1 in your URL, … Read more
I would intercept the template loader at template_redirect: function wpse53892_taxonomy_template_redirect() { // code goes here } add_action( ‘template_redirect’, ‘wpse53892_taxonomy_template_redirect’ ); Then, you would check to see if the query is a custom taxonomy: if ( is_tax() ) { // This query is a custom taxonomy } Next, get the term object, and find out if … Read more
This answer was a joint effort with tnorthcutt so I made it community wiki. There are several interesting functions available: the_taxonomies(), which calls get_the_taxonomies(), which in turn calls get_object_taxonomies() and wp_get_object_terms(). the_taxonomies() is a documented template tag and is a light wrapper around a call to get_the_taxonomies(), which is undocumented. get_object_taxonomies() returns a list of … Read more
If you want to check for the existence of a taxonomy, use taxonomy_exists( $taxonomy ): <?php if(taxonomy_exists(‘country’)){ echo ‘All courses in’ . get_the_term_list($post->ID,’country’, ‘ ‘, ‘ ‘, ” ); } ?> etc… Edit If, instead of checking for the existence of a taxonomy, you want to check if the current post belongs to a taxonomy, … Read more
There are some restrictions (caused by lengths of some columns in database). Taxonomies Taxonomy name – 32 characters Term name (and term slug) – 200 characters Posts Post type name – 20 characters Post name (slug) – 200 characters Meta key – 255 characters Options Option name – 64 characters Comments Commenter email – 100 … Read more
I’d suggest the Taxonomy Images Plugin. It says it’s in Beta but I’ve used it on a few sites already and it works great.
I solved this issue by making sure that the calls to register my taxonomies were placed before the calls to registering my custom post types. Weird but it works!
Here is what I came up with, seems to work: add_filter( ‘pre_post_tags_input’, ‘no_tags_input_create’ ); add_filter( ‘pre_post_tax_input’, ‘no_tax_input_create’ ); function no_tags_input_create($tags_input) { $output = array(); foreach( $tags_input as $tag ) if( term_exists( $tag, ‘post_tag’) ) $output[] = $tag; return $output; } function no_tax_input_create($tax_input) { if( !isset($tax_input[‘post_tag’]) ) return $tax_input; $output = array(); $tags = explode(‘,’, $tax_input[‘post_tag’]); … Read more
I believe WordPress can handle multiple query parameter by default. You can load http://wordpresssite.com/?taxonomy-1=term-a&?taxonomy-2=term-b to query all post that belongs to term a (in taxonomy 1) AND term b (in taxonomy 2). Use JQuery load() function to load the intended query parameter, based on the selected item on the sidebar. Hope this help.