WP_Query equivalent of SQL UNION ALL

You can run 2 wp_query, get the ids and pass those as the post__in parameter to a 3rd wp_query. Not efficient but will do the job. Or you can use a subquery and do it all with just one wp_query. Something like the following: add_filter( ‘posts_where’, ‘myprefix_posts_where’, 10, 2 ); new WP_Query([ ‘post_status’ => ‘publish’, … Read more

WordPress query_posts with multiple tax_query

You could build an intermediary array for the tax_query parameter: $tax_query = array(); $taxonomies = array( ‘product_cat’, ‘sub_category’, ); foreach ( $taxonomies as $taxonomy ) { if ( ! empty( $_POST[ $taxonomy ] ) ) { $tax_query[] = array( ‘taxonomy’ => $taxonomy, ‘terms’ => $_POST[ $taxonomy ], ); } } query_posts( array( // … ‘tax_query’ … Read more

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