if you need to turn it into an array of IDs then it is already an array of IDs, you don’t need to do any work on it, it’s already in the perfect form to go straight into the terms
parameter
e.g.
'terms' => $terms,
The only thing to be mindful about though, is that get_field
is not a WordPress function, it’s an ACF function, and you will need to handle the situation where this field has no value or an error occurs. You will need to ask how to handle that in an ACF community or via their support as ACF fields are off topic here.
Related Posts:
- Filtering posts by custom field value not working
- Display link to taxonomy archive only if it has posts with certain custom field values
- How to use the Term Object from a custom select field in a query
- How can I use order_by to order by two meta_keys without excluding posts that don’t have those keys initialized?
- Display posts the match taxonomy term linked from wp_list_categoies?
- Move posts to top of WP_Query if in certain Taxonomy?
- Sorting Posts by custom field
- Order posts by date and then by custom field
- Querying Multiple Custom Taxonomy Terms
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- meta_key and meta_value not working together
- How can i make WP_Query return post image and categories?
- Custom Field sort not working (WP 3.8.1)
- Filter WordPress posts by between parameter
- How add a custom posttype name using ACF field to a query post array
- Ordering Posts Type A by Custom Fields of related Post Type B
- Order taxonomy terms in alphabetical order
- How do I search inside specific taxonomies in WordPress
- Search Posts with Custom Fields as query
- exclude posts with a specific custom field and value
- Getting Taxonomy inside WP_Query Loop
- Complex WP_Query (two post types and multiple operators)
- Add quicklink to in the Admin posts page where I can query by a meta_key
- How to make Meta Query case sensitive?
- Remove category from query (show all posts in archive.php) pre_get_posts()
- Display Featured Post by Categories and Avoid duplicated posts
- Meta_query with multiple keys and multiple values
- Get authors by term id or slug
- meta_query BETWEEN, but the range is stored in the custom field
- Get a list of posts with associated meta_value
- WordPress Comments sort by custom meta key
- Understanding the orderby in WP_Query?
- How to list custom fields as headers and list all pages sharing that custom field under it?
- How to Union two different conditions in one WP_Query
- Order by empty custom field
- How do I exclude the lowest level terms in a taxonomy?
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- wp_query args adding muitiple tax_querys
- How Can I Change The Tax Query For The Main Loop For Taxonomy Archives?
- Search posts missing a particular custom field
- wp_query to print posts if have X custom field value
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- Conditional operator OR not working with custom fields
- How to add custom meta to ‘pre_get_terms’?
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- WP_QUERY with group by with custom fields
- How to order posts on each different category?
- Intiger meta value with ‘>=’ returns posts with lower value
- Get posts in taxonomy randomly
- Loop posts based on permalink term
- Posts query according to meta box date
- create metabox to activate slider
- Query posts using less than
- Excluding posts with certain value of meta_key keeping posts without that meta_key
- Query only displays one page_id
- Display post meta conditionally based on it’s value
- Query using string from custom field as array value
- How to show list of posts with custom field value (a date) that are coming soon
- Sorting posts by Multiple custom fields in defined order
- Don’t repeat posts from children in parent taxonomy query
- Show multiple tax_query from 2 or more post_type in a single code
- meta_query weird behaviour, static int will work, but not user data
- Woocommerce Shortcode which displays a table with product data
- Strange behaviour of hierarchical taxonomy archive
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Only show tag with the same id as the post
- Query posts by post type, author and post meta
- tax_query not working on custom post type
- Trouble with serialized metadata
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- wp_query with meta_query and tax_query
- Query post by Category and custom file (ACF)
- Problem with my loops
- ACF Post Object meta-query by title not ID
- Sort posts on custom field AND after that sort on date?
- How to break up output of posts for different terms on same page?
- From admin edit user page query either the user_nicename or username field value of the user profile being edited or viewed
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- Query by meta value (add a dropdown of all values)
- taxquery taxonomy get terms
- pages shortcode filtering by category
- How to show terms from another taxonomy
- How to define a custom hierarchy for terms?
- WP_Query with Pagination and orderby meta_value_num showing duplicates
- Mathematical operations on custom field values? (updated)
- Search format not matching taxonomy query
- Custom search (wp query by custom fields)
- How do I display posts with specific value in a custom field into my loop?
- Custom Search Query – include only custom fields and title
- query_posts with sorting on a custom datestamp
- Display all custom meta field values from the database using ACF Repeater
- Taxonomy related query not working
- Multiple Orderby is not working right
- WP_Query – order with usort by custom meta
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Best performance for use Custom Field in WP
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string