Orderby ASC changes to DESC in WP_Query

You’ve made “orderby” and “order” part of the date_query sub-array. “Order” parameters belong to the main parameters array. I can’t vouch for the part of your code that concerns the year and the above-undefined variable $ppy, but if you want the posts from a specified year in ascending order by ‘post_date’ (which is the default), … Read more

I did group my search results by post type, but how can i give each of them its own order?

Here’s one suggested high level approach to get the desired effect. Rather than perform all your operations in one big while loop in your searchresults.php, try: establishing three arrays corresponding to each type- you can do this in one while loop. then sort each array as needed (refer to PHP’s Sorting Arrays documentation for the … Read more

Issue with multiple orderby values

In your meta query you also need explicitly query posts that don’t have that meta key set. You can do this by nesting meta queries like so: ‘orderby’ => array( ‘meta_value_num’ => ‘ASC’, ‘menu_order’ => ‘ASC’ ), ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘relation’ => ‘OR’, array( ‘key’ => ‘newprice’, ‘type’ => ‘decimal’, ), … Read more

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