meta_query sorting by 2 keys

OK, the final workaround would be to split query: $sfp_query_args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘sfp_post_category’, ‘terms’ => $cat_id_arr ) ), ‘meta_key’ => ‘is_sponsored’, ‘post_type’ => ‘sfpposts’, ‘post_status’ => ‘publish’, ‘showposts’ => (int)$per_page, ‘paged’ => $paged ); …and use “posts_orderby” filter to modify ORDER part: add_filter( ‘posts_orderby’, ‘sfp_modify_orderby’ ); function sfp_modify_orderby( $orderby … Read more

Meta query terribly slow

I’ve come across this problem and it seems MySQL doesn’t deal well with the multiple joins to the same table (wp_postmeta) and OR-ed WHERE that WP generates here. I dealt with it by rewriting the join and where as mentioned in the post you link to – here’s a version that should work in your … Read more

How to do a meta query using REST-API in WordPress 4.7+?

You can write your own REST handler for custom queries if you want. In your case, the query can done by doing so: // Register a REST route add_action( ‘rest_api_init’, function () { //Path to meta query route register_rest_route( ‘tchernitchenko/v2’, ‘/my_meta_query/’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘custom_meta_query’ ) ); }); // Do the actual … Read more

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