wp query with multiple taxonomy?

You can have more than two. You could have as many as you like but you may have performance penalties if you try to use too many. I’d expect this to be true especially if you use an OR relationship. See the following for a way to create your tax_query array dynamically. https://wordpress.stackexchange.com/a/97444/21376 To adapt … Read more

Select posts wich has no relationship in custom taxonomy

I have found an answer by myself, for those landing here by google: $taxq = array( array( ‘taxonomy’ => ‘story_lng’, ‘field’ => ‘id’, ‘operator’ => ‘NOT EXISTS’, ) ); That results in AND (NOT EXISTS( SELECT 1 FROM wp_term_relationships INNER JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id WHERE wp_term_taxonomy.taxonomy = ‘story_lng’ AND wp_term_relationships.object_id = wp_posts.ID)) AND … Read more

What’s wrong with this WP query?

Turns out, WordPress joins the postmeta table several times, depending on the meta query arguments. Yes that’s correct, and it’s also the reason why I said (in my other answer) that in an orderby array, you should use the key of an array in the meta_query which contains a direct item named/keyed key (where the … Read more

pagenavi with merged wp_query [duplicate]

The WP_Pagenavi FAQ links to the following article to explain how to use the Pagenavi plugin with a secondary query by passing the wp_pagenavi() function a query parameter. From the tutorial: $my_query = new WP_Query(); while ( $my_query->have_posts() ) : $my_query->the_post(); the_title(); // more stuff here endwhile; wp_pagenavi( array( ‘query’ => $my_query ) ); wp_reset_postdata(); … Read more

How do I create my own nested meta_query using posts_where / posts_join?

Here is a rough outline of how you’d go about making a UNION work with WP_Query. add_filter( ‘posts_request’, function ($clauses) { $clauses = str_replace(‘SQL_CALC_FOUND_ROWS’,”,$clauses,$scfr); $scfr = (0 < $scfr) : ‘SQL_CALC_FOUND_ROWS’ : ”; $clause2 = $clauses; // manipulate this return “SELECT {$scfr} u.* FROM (({$clauses}) UNION ({$clause2})) as u”; }, 1, 2 ); Set up … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)