How to properly escape values in meta query

The problem is that you’ve interpreted wpdb::esc_like as a literal copy paste, and not a direction, and used it as a static function, when it is not a static function. Good: global $wpdb; $foo = $wpdb->esc_like( $bar ); Bad: $foo = wpdb::esc_like( $bar ); Other things to note: The & in &$wp_query ) is a … Read more

latitude/longitude meta_query

In both examples, you are searching between ‘max’ and ‘min’, where it should be between ‘min’ and ‘max’: array( $dist[‘max_latitude’], $dist[‘min_latitude’] ) ‘value’ => $dist[‘max_latitude’], ‘compare’ => ‘>=’); ‘value’ => $dist[‘min_latitude’], ‘compare’ => ‘<=’); Both mean: “Search for a value that ist greater than max_latitude and less than min_latitude” Another finding why my own meta_query … Read more

Ordering custom posts by meta field date

You are not querying/saving the correct meta_key. For example, looking at your code, you pass $typename variable to update_post_meta() as meta_key and $typename=”events”. But later in the query you are querying for meta_key = date. Also, you pass $meta as meta_value and in your actual code $meta is an array containing multiple values (location, date, … Read more

Sorting posts by ACF field

You are not going to this in one query, you will need to do two queries. The first query will hold the posts which will hold the meta key, the second will be the posts without the meta key. (Just a note: never use query_posts unless you intentionally wants to break things) You can try … Read more

WP JSON API meta_query not working

Per the comment from @ialocin I switched from WP JSON API to WP REST API. There is much less documentation with the rest api but it’s customizable using native wordpress functions. Also, it has a nifty github plugin for allowing use with ACF custom fiends. Anyway, the documentatino for customization the wp rest api is … Read more

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