Extend meta query arguments

Try this $args = array( ‘post_type’ => ‘events’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘fl_type’, ‘value’ => ‘Awards’ ), array( ‘key’ => ‘fl_expire’, ‘value’ => 0, ‘type’ => ‘NUMERIC’, ), array( ‘key’ => ‘fl_global’, ‘value’ => 1, ‘type’ => ‘NUMERIC’, ), ), ‘posts_per_page’ => -1, ‘meta_key’ => ‘fl_order’, ‘orderby’ => ‘meta_value_num’, ‘order’ … Read more

meta query based on month regardless of year

While the regexp solution will function, it quickly gets slower as the number of users increases. This is because the database cannot perform optimisation and indexing tricks, and forces a full table scan. The more users, and the more meta, the greater the cost of the query. At a minimum it requires caching to avoid … Read more

Is this meta query problematic?

Short answer is: Big Meta Queries are incredibly bad and can quickly lead to the MySQL-Server not responding anymore. You should try to rework the meta_query to not have so many clauses. Long Answer: Wordpress Post Metadata is stored incredibly inefficient when it comes to querying. Best advise would be to never ever EVER store … Read more

ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?

New answer I now have a better understanding of the question thanks to OPs comment and have come up with the following. Not tested! global $wpdb; /** * @var string $field The flexible content field name. */ $field = ‘a_flexible_content_field’; /** * @var string $layout The flexible layout name. */ $layout=”layoutTwo”; /** * @var string … Read more

WP Query ordering on a meta field for posts with a date in the future not ordering by datetime

The docs are a little vague in this area, but it should be possible to define your ordering value more succinctly: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 5, ‘category__in’ => $postCategories, ‘meta_query’ => array( array( ‘key’ => ‘ordering_date’, ‘value’ => date(“Y-m-d H:i:s”), ‘compare’ => ‘>=’, ‘type’ => ‘DATETIME’, ), ), … Read more

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