if wp_query taxonomy term have posts

I’m not sure what you exactly need, but normally, by default, get_terms returns only terms that actually have posts assigned to them $terms = get_terms( ‘exhibition’ ); var_dump( $terms ); Apart from this, I really do not know what you exactly need

WP_Query OR clause for tax_query and keywords

Here’s a little experiment: You can try the following setup: $args = array( ‘wpse_search_or_tax_query’ => true, // <– New parameter! ‘s’ => ‘some search text’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘some-category-slug’ ), ‘operator’ => ‘IN’, ), ), ); $query = new WP_Query( $args ); where we introduce … Read more

Orderby = none not working [duplicate]

Order by none doesn’t do what you think it does. If you don’t specify an order, then MySQL doesn’t guarantee any particular order and will simply get the posts in whatever order it has them. Since they were inserted in a particular order, then you’ll probably get them in that order. Since you need the … Read more

assign 2 $args to one wp_query

array_merge does not work the way you expect/need it to, but honestly I am not sure why you are making this so complicated. All you need is: $args = array( ‘s’ => ‘keyword1 keyword2’, ‘orders’ => ‘DESC’, ‘showposts’ => 60 ); // var_dump($args); // debug $query = new WP_Query($args); var_dump($query->request); // debug The built is … Read more

Merge 2 args in one WP_Query and order it by date

A better approach could be using three queries. First two query retrieve the post ids, and third one query post by ids. // first query $first_ids = get_posts( array( ‘fields’ => ‘ids’, ‘posts_per_page’ => ’10’, ‘post_status’ => ‘publish’, ‘post_type’ => array(‘news’,’partners’), ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ )); // second query $second_ids = get_posts( array( … Read more

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