You could approach in two steps. First get all the users that match your criteria
$user_ids = get_users([
'meta_key' => 'activeacc',
'meta_value' => true, // or whatever value you are storing
'fields' => 'ID',
]);
and then run your WP_Query
for only those users
$properties = new WP_Query([
'post_type' => 'property',
'author__in' => $user_ids,
]);
There is no need to set post_status => 'publish'
since it’s the default.
Also would be possible to accomplish the same in just one query with posts_clauses
filter but I will not develop it here.
See https://developer.wordpress.org/reference/classes/wp_user_query/prepare_query/ for all available arguments for get_users
.
Related Posts:
- Nested meta_query with multiple relation keys
- Query Multiple Post types each with own meta query
- Perform query with meta_value date
- Meta Query with date and time on the same Day before given time
- How do I create my own nested meta_query using posts_where / posts_join?
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- WP_Query last five posts, simply ordered by meta_value
- Fetch Record based on meta key dates
- How to display multiple custom fields with the same meta_key in an ascending order?
- how to make members list directory through wordpress post custom meta key.
- How to provide meta_key array to wp_query?
- Show single posts date, in a page of posts
- Why doesn’t my WP Meta Query return any results?
- WP_Query Class custom field parameters
- How do i create a custom post query when the meta value is an array?
- ElasticPress is (aparently) messing with my search filters
- Query for current post
- Custom query to retrieve oldest post and retrieve others with date interval
- Orderby query does not work for custom fields even with meta query
- Custom WP_query and integrating into theme file
- query post based on comparison
- WP_Query vs get_posts
- Order posts by ID in the given order
- ACF Relationship Field Search Filtering [closed]
- Get the number of posts from the current page results
- Execute a large WP_Query with many “AND” Meta_Queries?
- How to know which one is the main query?
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- WP Meta Query for some meta (array) values
- Sort users by meta_value_num
- meta_query with array as value
- Using WP Query to search within ALL keys in meta query
- WP Query – Get WooCommerce Products with variation that is in stock
- Multiple search queries on one page
- Meta_query with or without value
- How add a custom posttype name using ACF field to a query post array
- Meta query field order together with post_date order causes posts without the meta field to be unordered
- Page navigation doesn’t show when query category
- Undefined property: WP_Query::$post
- 2 loops on page – one with orderby rand second orderby date
- WP_Query meta_query >= date
- wp_query not searching with apostrophe
- Extending woocommerce admin product search
- Custom query based on meta key – Reduce three states to two in results?
- Five posts from a category in footer
- Performance when getting post meta for post retrieved by meta value
- Query by multiple meta elements not seeming to work – wordpress is timing out
- Meta_query with multiple keys and multiple values
- Tax query AND/OR meta query [duplicate]
- Help ordering Post loop by two meta values
- How to exclude post formats from wordpress recent posts in a tabs widget [closed]
- How to increase load time of an archive/search page (WP_Query)
- Easy way to write complex queries in wordpress
- get_posts output always same post
- Query_posts works when appending via AJAX call wp_query doesn’t?
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Is this meta query problematic?
- 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
- Custom query filter by ACF date custom field
- Query by date from custom field
- Nested array issue in meta_query
- Error in meta_query not get result
- Get next/prev image/attachment in time with date query
- How to get current page nearest parent id?
- meta_query with array as value with multiple arrays
- Trouble Making WP_Query paged
- Sort posts using multiple custom fields and menu_order in single query?
- Optimising WP_Query with ACF Fields
- Filter products on category AND tag
- meta_query – check for multiple meta values in key which holds an array of values
- How do I stop the same post showing multiple times in a archive?
- 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
- trying to change from query_post to WP_Query
- 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
- WordPress For Loop Prints Unwanted Extra Paragraph Element
- Query by meta value (add a dropdown of all values)
- query_posts() doesn’t seem to be called in my page
- WP_Query returns empty if meta_query has more than 7 values
- Fetching $_POST from Page Template into functions.php
- Use not custom fields in get_posts() meta_query?
- WordPress meta_query not working
- Using orderby with 2 meta keys
- Optimising specific Query with ACF meta objects
- query_posts with sorting on a custom datestamp
- Passing conditional arrays to WP_Query() [closed]
- Query Posts by date range with fixed beginning and end
- Get all user with both meta_value
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Get posts using multiple values from ACF checkbox as meta query wordpress
- get_post_meta bringing back results, but $wpdb->postmeta doesn’t
- Custom query with custom filtering returning incorrect results