WordPress hiding posts without content on custom taxonomy query. How to solve?
WordPress hiding posts without content on custom taxonomy query. How to solve?
WordPress hiding posts without content on custom taxonomy query. How to solve?
When you inspect your SQL query right after you executed it $GLOBALS[‘wp_query’]->last_query you will see that the SQL statement is asking for AND. Jump into the posts_where or the the posts_clauses filter (where you need to look up the where keys value) and alter it to OR.
You’ll want to have a look at get_the_terms(). <?php // You need to define the post id from the post you are outputting in the right bar so that the left bar knows how to match up the terms $country = get_the_terms( $post->id, ‘countries’ ) $args = array( ‘post_type’ => ‘side_menu’, ‘posts_per_page’=> 1, ‘tax_query’ => … Read more
Display related posts with same category or same tag return blank
@Milo found that the problem was with the code to order by the track number taxonomy. I’m going to make track number a custom field.
The issue I had with my search was that the select field’s name was the same name as the taxonomy being queried. When I used a different name for the select field my query worked as it should. <?php wp_dropdown_categories(array( ‘name’ => ‘special_day_select’, //anything else besides an existing taxonomy name. ‘taxonomy’ => ‘special_day’ )); ?> … Read more
I’m not sure how you set up looks, but it does seem that you have a lot of taxonomies registered to your post type, so I don’t think it will be very viable to use the the exclude parameter in get_terms() to exclude the specific term. What I would suggest is, inside your foreach loop … Read more
Try changing the field value to term_id, since there is no id value for that option. Ref: WP_Query Taxonomy Parameters
You can use get_ancestors() to get an array of parents, which you can then count. $term_id = 42; $ancestors = get_ancestors( $term_id, ‘category’ ); if( ! empty( $ancestors ) ){ echo count( $ancestors ); }
I’m not sure if this is a bug, but it need further investigation. I’ve run a few quick tests on the name field in a tax_query, and whenever a term name has got a special character or have more than one word, the tax_query is excluded from the SQL query TEST 1 I have use … Read more