I found a solution that works (thanks Steve), hopefully somebody will find this useful in the future
$sql = "SELECT p.ID FROM wp_posts AS p
WHERE post_parent = $post->ID
AND post_type="post_type"
AND ID IN (
SELECT post_id FROM wp_postmeta AS pm
WHERE pm.meta_key = 'my_acf_key'
AND pm.meta_value = p.post_title
);";
$idList = $wpdb->get_col( $sql );
Related Posts:
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Custom WP_Query order by post_meta and (author) user_meta
- Query WooCommerce orders where meta data does not exist
- Perform query with meta_value date
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Meta Query for specific months
- How to orderby meta_value_num with dollar ($) sign
- Optional Meta Query
- Overwrite YoastSEO meta-tags with another page’s [closed]
- How to orderby multiple meta fields if some fields are empty
- Meta Query relation “AND” then set array accordingly
- How to set up hierarchical relationships without using plugins / meta query
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Why doesn’t my WP Meta Query return any results?
- WP_Query meta compare must include ALL array values
- Query multiple post types, but different order for each
- Woocommerce Get Orders By Meta Value
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Meta query orderby meta_value_num sorting by role first
- Query against multiple locations within single custom post type post
- Strange results from WP_Query
- WP Query. Ordering posts by another post types meta
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Query by meta value (add a dropdown of all values)
- Meta query doesn’t remove placeholder escape before query
- What is the best way to reset a search on a meta_key / meta_value?
- How can I modify standard search query to include also ACF custom fields values?
- Filter posts/pages by user_role array
- Use meta query only 3 or more results?
- Use value from meta key array for use in WP_Query
- Return only Count from a wp_query request?
- Meta query with string starting like pattern
- how to show posts that are missing a meta_value
- pre_get_posts with get_posts
- author.php with ACF and CPTs
- Query Custom Meta Value with Increment
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- Identify which loop you are hooking into; primary or secondary?
- 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
- Finding the next 5 posts
- view queries made?
- Pass the same object to multiple widgets in a template with one query
- Use meta_query to display events by date in custom field
- How to show recent and upcoming birthdays using meta_query
- What is considered a default query for the request filter?
- Using WP_Query and WP_Meta_Query Outside of WordPress
- How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
- If two first numbers exist in wp_meta_query value
- WP_Query on custom field and order results
- Tax query clause inside a meta query clause?
- Change query_posts to WP_Query in page but does not work
- WP Query with custom Shortcode
- Set conditional on template based on referring page slug
- How do I make a meta_query OR relation work? [closed]
- Iterating through $wpdb query without using get_results for large query results
- Meta_query on same meta key, with diffrenct values
- Can we return all category (not post) with Custom Query Filter? [closed]
- Filter posts in category archive page by year using a dropdown
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Include data from custom table in WP_Query
- How to get a query variable?
- WP_Query with meta_query dosen’t return results
- date_query seems to be ignored by wp_query
- Better wordpress attachment query than this
- Is it possible to query from external database? [duplicate]
- Can’t sort custom post type by random
- How to provide meta_key array to wp_query?
- Meta query compare for ID’s greater than specific ID
- Is it possible to add relation between meta_query and tax_query?
- wordpress udpate query not equal to
- Show single posts date, in a page of posts
- WP_Query Class custom field parameters
- Query on meta values and post title
- How do i create a custom post query when the meta value is an array?
- Custom Meta Query doesn’t work the same on two site
- WP Query – grouping posts by same meta key, adding together values from another key
- setting offset to category number in archive page
- Query for current post
- Custom query to retrieve oldest post and retrieve others with date interval
- Very slow query generated getting meta data from posts
- How to filter on placeholder image
- How to query 5 users in random who have published more than 10 posts
- Slow query when selecting with large meta query or post__in
- Bring a post to the top of the query if it’s in a certain category?
- WP Meta Query at depth 2
- Conditional posts in WP_query for search
- WP_Query with child element
- Using URL variables on a custom WP_Query
- Pagination is not working on custom query inside a custom home page template
- Sorting: custom query with orderby meta_value_num THEN by title
- WordPress Query showing multiple titles
- custom query to get posts
- confirm my booking with phone number
- shortcode using multiple WP_Query’s with multiple category names not fully functional
- Can’t figure out query logic
- WP_Query orderby not working on custom post_type