You are looking for this, most probably. Note: meta query support a compare method what is ‘IN’, which means any of the value. Like this –
if( isset($_GET['H_property_type']) ){
// you don't need relation for this
// if(count($_GET['H_property_type']) > 1){
// $args['meta_query']['relation'] = 'OR';
// }
// if $_GET['H_property_type'] is an array
// foreach ($_GET['H_property_type'] as $type) {
if( isset($_GET['H_property_type']) && is_array($_GET['H_property_type']) ){
$args['meta_query'] = array(
'key' => 'H_property_type',
'value' => array_map( 'trim', $_GET['H_property_type'] ),
'compare' => 'IN'
);
}
// }
}
Commented codes are not necessary for the query. Thanks.
Related Posts:
- WP_Query – Order results by meta value
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Filter WP_Query for posts having a certain meta-value
- Can I query custom meta data through WP_Query
- Meta Query with AND & OR?
- How do I search an array stored in a custom-field using WP_Query?
- How do I order by multiple custom fields using wp_query?
- Trying to perform complex custom field query with order by set to field value
- Query meta field using between
- Order Posts by Closest Numeric Values
- 2 orderby in wp_query with 2 custom fields
- Can serialized arrays in DB be matched against serialized arrays with meta_query?
- How to get a meta value from all post
- Compare meta_query decimals not working right
- WP_Query multiple use of relation and/or
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- Using OR in WP_Query negates the “NOT EXISTS” compare
- WP_query : meta_key with custom rule for specific value
- How can I combine meta_query queries?
- How to filter a dd/mm/yyyy date from a custom field in a query
- Using WP Query to search by multiple meta fields
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- Compare WP Custom Field date
- Sort by posts that have a featured image?
- WP_Query display next custom post from today’s date
- Order by value in serialized custom field
- $wp_query meta_key naming issue [closed]
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- Meta_query and numeric comparison [closed]
- Adding Custom Fields to Search
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Any way to include custom fields in WP_Query results?
- Multiple relationships in a query
- WP Query Returning All Posts
- How do I use wp_query for WordPress search?
- Meta query with timestamp using WP_query
- Conditional custom field query
- Order query by meta_value with multiple custom fields
- Auto Populate Custom Field with Complex Value That Increase by One?
- Custom WP_Query for WordPress Search Results with meta_query
- Meta Query And/Or
- How to combine custom fields to make one order-able value
- Passing meta_box string to post__in?
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- meta_value and meta_key filtering returning no posts [closed]
- Select custom posts by meta_value and sort by a different meta value
- Can’t query by meta_key
- Adding custom field and querying from post table
- The best way to collision check in WP
- WP_query multiple custom fields not working
- Custom Query Fields – Altering Meta Value
- How to query for posts with either one or another custom field
- Multiple Custom Field Query
- How to update custom field of a posts in a particular category
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- WP Query multiple select form – meta_query help
- How to Order Posts by Custom Fields?
- WP_Query based on multiple metadata comparisons
- Complex WP_Query Using Post Date And Post Meta
- Display posts where date field matches current month?
- Show posts containing or not custom field
- Display agents (custom post type) alphabetically, except one who always shows last
- Query posts by Custom Meta (checkbox) & Genesis Grid Loop
- Is there a way to set default custom fields when creating a post?
- WP_Query orderby custom field then post_date in one query
- Show only posts which can be commented OR have custom meta field
- How do I make a custom field choose an image?
- get_post_meta() unserialize issue – returns boolean(false)
- Edit Custom Database Tables in WordPress
- Change content before writing to database
- post meta data clearing on autosave
- Get post info inside modal window?
- Custom Field sort not working (WP 3.8.1)
- Add description text under input field for new profile fields
- Custom Fields Not in Search Results
- Get an advanced custom field after post publish
- Large AND OR query timing out
- Categorising search results based on Custom Fields
- Pull custom fields from custom posts within a loop
- Ordering posts by custom field named “date” in backend
- How to display custom fields from a plugin
- Adding “meta” info to WP site PHP function?
- WordPress Media Uploader custom Javascript not working
- Custom fields issue [closed]
- List custom queried terms in the edit-tags.php?taxonomy page
- Display custom field from the front page on another page
- WP query_posts group by meta field related
- Add a custom field to my custom post type and then get posts which are before the given date in the custom field
- Custom User Dashboard
- Custom meta POST request fired twice when updating a post in Gutenberg
- Extend WP_User_Query or WP_User to return all custom fields?
- WordPress taxonomy child image
- Create custom fields/meta data gender+country – radiobuttons and dropdown on register screen for these fields
- How do I display posts with specific value in a custom field into my loop?
- Download stuff after filling fields?
- Querying meta values within an array
- Filter Custom post type by another Custom post type
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?