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
- How to use meta_query to retrieve posts from multiple custom post type
- WP_Query filtering in ACF field containing dates
- Problem making a WPQuery with ACF boolean
- Meta_query compare operator explanation
- meta_query with meta values as serialize arrays
- Nested meta_query with multiple relation keys
- meta_query ‘compare’ => ‘IN’ not working
- Use REGEXP in WP_Query meta_query key
- WP Query Args – Title or Meta Value
- Meta query with string starting like pattern
- compare meta_query in get_posts arguments
- How to query posts based on lat-lng coordinate as post meta?
- how to show posts that are missing a meta_value
- Set Alias for meta_query arguments in get_posts()
- Sorting: custom query with orderby meta_value_num THEN by title
- Display List Of Posts Containing a Relationship Field Value [ACF]
- Display products from specific category in shop page
- Can I query custom meta data through WP_Query
- Using OR conditions in meta_query for query_posts argument
- How to Compare Two Meta Fields
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Does tax_query really beats meta_query in all situations?
- WP_Query with checkbox meta_query
- Add indexing to meta_value in wp_postmeta
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Custom WP_Query order by post_meta and (author) user_meta
- Query WooCommerce orders where meta data does not exist
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- Filtering a WP_Query meta_query by numeric values isn’t working
- Getting attachments by meta value
- Query Multiple Post types each with own meta query
- What kind of object type is WP_Query?
- Execute a large WP_Query with many “AND” Meta_Queries?
- How can I save an array from a random post sequence for later use?
- How to query serialized array by comparing greater than (>=)?
- Query all posts where meta value is empty
- WP_Query min and max values
- Getting an array out of WPQuery
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- Using custom meta_query with relation not working as expected
- Perform query with meta_value date
- querying with custom meta field with meta_query
- Order by two meta keys
- multiple meta key but get server load is very high
- Meta Query with date and time on the same Day before given time
- A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value
- How to grab metabox value in wp_query meta_query key
- WP_Query meta_query where meta value ends in space
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Nested query inside Logical operator OR not working in meta_query
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- WordPress meta_query and order by custom field
- Query by meta_key and order by meta_value_num return orderby date
- What is an efficient way to query based on post_meta?
- assign 2 $args to one wp_query
- WP_Query not working as expected for attachments and custom meta_query
- datetime picker, timestamps and meta queries
- Use Transient API to cache queries for all posts in all categories?
- How do I create my own nested meta_query using posts_where / posts_join?
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Revolution Slider Orderby Two Custom Fields
- Compare two meta-fields in a wp_query (where meta-field-A is larger than meta-field-B)
- Wp_query order by multiple custom fields?
- How can I create a WP_Query that returns posts where one meta_value
- Meta Query querrying several post types based on ACF fields is broken after update to WP 4.1