WP_Query with meta_query no results

Your code looks correct. Have you checked your stored meta data to confirm the value stored is 1? Also, have you tried comparing to a string value, eg ‘1’ instead of 1? Just a stab in the dark, but worth a shot. Assuming your stored values are correct, and seeing as the values can only … Read more

Query custom field with date

According to the relevant article on the WordPress Codex, you should be able to add a type argument to the meta array. Resulting in something like this: $meta_query = array( array( ‘key’ => ‘date-available’, ‘value’ => date(“m/d/Y”), ‘compare’ => ‘<‘, ‘type’ => ‘DATE’ ), ); It’s worth noting, though (as Gopalakrishnan18 mentioned), MySQL expects a … Read more

How do you get Posts by multiple meta_keys and meta_values with the Rest API V2?

You can hook into the rest api query and add your args from url’s parameters The code will look something like: function query_post_by_fields($args, $request) { $url_params = $request->get_param; //Modify $args with your url params return $args; } add_filter(‘rest_post_query’, ‘query_post_by_fields’, 10, 2); Docs: https://developer.wordpress.org/reference/hooks/rest_this-post_type_query/

meta_query not working on live site

My reputation is too low for me to comment so I’ll do it this way. Make sure that the date format inside ‘value’ is the same as the date formats inside the database fields. Also don’t forget to add the ‘type’ => ‘DATE’ to your query. An example of some code that I’ve used in … Read more

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