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
- Meta query with string starting like pattern
- How to query serialized array by comparing greater than (>=)?
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- querying with custom meta field with meta_query
- Order by two meta keys
- multiple meta key but get server load is very high
- A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value
- How to create/modfiy WP_Query to search in post title OR custom field?
- Multiple meta queries but arrange by specific meta value order
- ACF – Get lowest & highest value from field
- What format does the meta_query TIME type require?
- pre_get_posts order by not working
- WP_Query filter and order by meta ordering by wrong joined table
- WP_Query last five posts, simply ordered by meta_value
- How To Fix WP Query Returns Results But Shouldn’t?
- meta_query in WP_Query value is not accepting array
- Weird orderby => post__in issue
- Is there a way to work with a specific the_field from an already queried post? [closed]
- Changing sort order for presentation by Jetpack infinite scroll
- meta_value_num not ordering all items
- Meta Queries – should nesting work after WP 4.1?
- Filter and Order by Multiple Custom Meta Values
- Meta Query relation “AND” then set array accordingly
- 2 weeks ago from meta query meta value
- Redirect to another page using contact form 7? [closed]
- Query posts with “non set” meta value
- Ordering a mysql style datetime stamp with meta_query
- WP User Query with Custom Fields and Search Results
- Wp_query with 2 meta keys and array of meta values
- meta_query: check if number exists
- Event with multiple dates, display events chronologically
- How to avoid filling up an array each time I run a WP_query?
- WP Query / Meta Query [duplicate]
- Query multiple post types, but different order for each
- How to add date_query to meta_query array
- Order by the first array within a meta_query
- Query ACF relationship field – Comparator IN – Value array
- Combine query in WP_User_Query()
- Nearby locations using Advanced custom fields, maps?
- Multiple nested meta queries
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- How can I modify the query by adding to the existing query?
- Combine relationship posts with existing wp_query
- create custom shortcode wp and put php code in
- WordPress Query custom ordering by temporary variable
- Comparing Meta Field date in WPQuery using Meta_Query?
- How to create better WP_Query to look for date time which is anywhere between two meta values?
- Multiple meta_query not working
- compare for multiple meta values for same key in wp_query
- datetime picker, timestamps and meta queries
- WP_Query with meta_query won’t orderby
- meta_query only check if both value are set
- Wrap group of wp query posts to parent div by date/year
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Wrote a WP Cron Plugin and it triggers a fatal error upon activation
- how to query for meta_value have array
- Get the type of an advanced custom field (ACF) in a WP_Query loop [closed]
- Looking for a way to exclude frontpage and nav menu from query filter
- Dynamically name array in WordPress loop – add/get values
- Get posts by meta value except one post [closed]
- WP_Query by meta key not returning any posts
- WordPress extremely slow when using get_posts with multiple meta_query relations
- wp_query, calculate with two dates when ‘key’ is text format
- Include custom post type that matches taxonomy field in another custom post type