The sorting of posts by a meta_query with two keys fails while separated as single queries it works

You can only sort on 1 meta value. A few posts (including this SE answer) suggest adding a filter to change the order. Add a function to your theme’s function.php file that will replace the sort order: function change_sort_order( $orderby ) { return str_replace(‘wp_posts.post_date’, ‘mt2.meta_value, mt1.meta_value’, $orderby); } Then use it where you want. Make … Read more

Change ‘post_modify’ with a query

Thanks @Marin Atanasov and @hobo to help me to solve my problem on stackoverflow. If you are interested you can check the solution here The problem was in the way i wrote the query, because it needs quotes around the date (eg = ‘”.$data_modifica_post.”‘).

new WP_query using custom fields

This is what works in my query: <?php $argsfeature = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘page’, ‘order’ => ‘DESC’, ‘posts_per_page’ => ‘1’, ‘meta_key’ => ‘featuring’, ‘meta_value’ => ‘1’ ); ?> and this query works: <?php $argsarticles = array( ‘post_status’ => ‘publish’, ‘post_type’ => ‘page’, ‘order’ => ‘DESC’, ‘posts_per_page’ => ‘5’, ‘post_parent__in’ => array(10,11) ); … Read more

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