WP Query – grouping posts by same meta key, adding together values from another key
WP Query – grouping posts by same meta key, adding together values from another key
WP Query – grouping posts by same meta key, adding together values from another key
For meta_query with ACF and ordering price by ASC or DESC try following code. $args = array( ‘post_type’ => ‘property’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘price’, ‘orderby’ => ‘meta_value_num’, ‘order’ => $_GET[‘orderby’], ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘contract’, ‘value’ => $_GET[‘contract’], ), array( ‘key’ => ‘rooms’, ‘value’ => $_GET[‘rooms’], ), … … Read more
meta_query – check for multiple meta values in key which holds an array of values
get_posts filter meta_query using ACF Checkbox
How would you save such a repetitive data pair inside MySQL? As separate key/value pairs, which is what you have already done. The only situation I would reconsider this, is if you need to filter or search for restock posts via these IDs. If that is the case then I would use a private/hidden taxonomy … Read more
If you just want to count the total number of posts that matched a specific query, then there’s no need to set the posts_per_page to -1. Just set it to 1 instead. And $count_posts->count returns null because the WP_Query class doesn’t have a property named $count, i.e. WP_Query::$count does not exist. WP_Query does have $post_count … Read more
ElasticPress is (aparently) messing with my search filters
You can use insert_user_meta($user_id,’meta_key’,’meta_value’); when you want to get that keys, you can get like $keys = get_user_meta($user_id,’meta_key’); in $keys variable you get an array of all keys.
Search for value(s) in meta field for a multi select
This isn’t a direct answer, as my solution was to implement this another way. Instead of getting the values (array) from the homepages ACF field I added a date field to each of the pages I want to display. So, I query against that date (for each of those pages) instead of entering a list … Read more