I found a way to build a custom query that goes through the checkboxes the user selected and then adds an array for that value to the query dynamically. That way it checks to see if each value selected is in the serialized array, and then moves onto the next one. Runs a lot smoother than what I was doing before.
for ($i=0; $i< count($amenities); $i++)
{
$count = count($arrays);
$arrays[$count] = array(
'key' => 'amenities',
'value' => $amenities[$i],
'compare' => 'LIKE'
);
}
$the_query = new WP_Query(array(
'post_type' => 'listing',
'post_status' => 'publish',
'category_name' => 'private_rental',
'meta_query' => $arrays
));
Related Posts:
- ACF Relationship Field Search Filtering [closed]
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- WP Meta Query for some meta (array) values
- Can an array be used as a meta_query value?
- If two first numbers exist in wp_meta_query value
- WP_Query meta_query >= date
- ACF Date Based wp_query
- Custom query based on meta key – Reduce three states to two in results?
- What is the random string I am seeing when I use get_query_var?
- Adding an array from a query string to a WP meta_query
- Any number in meta key (wp query)
- WP_Query with meta_query dosen’t return results
- Custom query filter by ACF date custom field
- Get a list of ACF Repeater-Fields as array
- Multiple meta query from array
- meta_query returning excluded result
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- Trouble with serialized metadata
- WP_User_Query Orderby Not Working
- WP_Query, ACF field and array
- Pre get posts sort by meta key returns no results if meta key does not exist
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Get posts meta_query by repater field
- How can I modify standard search query to include also ACF custom fields values?
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Sort Posts with custom meta key by default which is currently set as optional
- Creating Custom Query
- How do I have multiple metaqueries inside one wordpress query
- Get posts using multiple values from ACF checkbox as meta query wordpress
- I want to place a post before all others from an ACF boleen field
- How do I subquery with custom meta fields?
- Use value from meta key array for use in WP_Query
- Meta_query compare operator explanation
- meta_query ‘compare’ => ‘IN’ not working
- Sorting: custom query with orderby meta_value_num THEN by title
- Display List Of Posts Containing a Relationship Field Value [ACF]
- Using OR conditions in meta_query for query_posts argument
- WP_Query with checkbox meta_query
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- How can I save an array from a random post sequence for later use?
- Meta Query with date and time on the same Day before given time
- How to grab metabox value in wp_query meta_query key
- How can I create a WP_Query that returns posts where one meta_value
- Using WP Query to search within ALL keys in meta query
- WP Query – Get WooCommerce Products with variation that is in stock
- Meta_query with or without value
- How add a custom posttype name using ACF field to a query post array
- Undefined property: WP_Query::$post
- WP Query for variable taxonomies
- wp_query not searching with apostrophe
- Extending woocommerce admin product search
- Performance when getting post meta for post retrieved by meta value
- Query by multiple meta elements not seeming to work – wordpress is timing out
- How to display multiple custom fields with the same meta_key in an ascending order?
- Meta_query with multiple keys and multiple values
- How to Union two different conditions in one WP_Query
- Tax query AND/OR meta query [duplicate]
- Help ordering Post loop by two meta values
- Multisite wp_query & switch_to_blog issue
- Removing duplicate values between two wordpress queries
- Include post content of linked posts in search
- Combine results of multiple WP_Query to resemble single WP_Query
- Is this meta query problematic?
- JSON – Create rest api endpoint for Advanced Custom Fields
- Appending to existing WP_Query’s meta_query if exists
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Query by date from custom field
- Nested array issue in meta_query
- Error in meta_query not get result
- How to get current page nearest parent id?
- Using WP meta query to show custom post types by a start and finish date
- meta_query with array as value with multiple arrays
- Why doesn’t my WP Meta Query return any results?
- Sort posts using multiple custom fields and menu_order in single query?
- Optimising WP_Query with ACF Fields
- WP_Query – display posts by custom field and order by another
- meta_query – check for multiple meta values in key which holds an array of values
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Getting posts by custom field value
- WP_Query on custom key and value
- Get posts having meta value between two numbers
- wordpress multiple meta value query is not working
- Strange results from WP_Query
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- Sorting with meta_query and multiple, optional meta keys
- Query by meta value (add a dropdown of all values)
- ACF: using two loops, the_field returns field content from another loop
- WP_Query returns empty if meta_query has more than 7 values
- Use not custom fields in get_posts() meta_query?
- WordPress meta_query not working
- Using orderby with 2 meta keys
- wp_query – Modify $query to include duplicate content
- How to get several fields from wp_query?
- WP Query posts__in not working with array
- Passing conditional arrays to WP_Query() [closed]
- Display all custom meta field values from the database using ACF Repeater
- Get all user with both meta_value
- WordPress extremely slow when using get_posts with multiple meta_query relations
- wp_query, calculate with two dates when ‘key’ is text format