To get the attached term IDs, use get_the_terms()
and wp_list_pluck()
:
if ( $terms = get_the_terms( $post, 'director' ) ) {
$term_ids = wp_list_pluck( $terms, 'term_id' );
}
Related Posts:
- Show posts without term
- List taxonomy terms plus their latest post ordered by post date
- Function get_queried_object() return NULL in custom taxonomy
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Filter Custom Taxonomy Posts
- How to add custom meta to ‘pre_get_terms’?
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- How to print term name inside wp post loop
- Check if a post has term inside loop
- display ACF repater field in archive page
- How to define a custom hierarchy for terms?
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- WordPress tax_query “and” operator not functioning as desired
- Custom taxonomy query broken after upgrade to 4.4
- How to add taxonomy filter on the query fly?
- Query two taxonomies via URL or link?
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- Counting number of posts with Category B in Category A
- Select posts wich has no relationship in custom taxonomy
- Get random terms
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Filter and list posts of a custom taxonomy
- WP_Query use for a filter with multiple Taxonomies and Terms
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- Setup of taxonomy term template pages
- How to do a query on custom taxonomies that is uncategorised?
- Order taxonomy terms in alphabetical order
- Empty tax_query array returns an empty array
- Pass array of taxonomy terms to wp_query
- Query Custom Post Type Order By Taxonomy Field
- Formulate a url to show posts with both taxonomy terms
- Query post from all category with same tag on 1 pages
- Query with custom taxonomy not working
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Order by slug in get_terms with multiple taxonomies
- WordPress Related Post by tags in Single.php
- showing all search result in one template
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Query custom post type by custom taxonomy (category slug)
- How to Filter Posts by Custom Fields?
- Show posts from a custom taxonomy on a page
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- wp_query for multiple cities (multiple values in a metabox)
- How to order posts by title after they have already been sorted by category
- Query with relation and one without relation using multiple taxonomies?
- Search form not working with custom query?
- Display custom tags on pages that have a specific page parent
- WP_Query args to show posts from specific custom taxonomy
- WP_Query for a taxonomy with different taxonomy types
- Using custom taxonomies in a query
- get_the_terms – but only show 4 Posts
- Count posts per taxonomy else change taxonomy if less than x number
- Custom Taxonomy Breaks Pages
- Wp_query…a type of term a different div
- Can’t get term id for category archive
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- How to make a post with certain taxonomy term display first before other post with only one query?
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Show X taxonomies of the latest published posts
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- display post count in archive page that have relation with another taxonomy term
- Save queried result into database
- Custom Taxonomy – Modify Function to Get Child Category
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- Get categories within specific term
- How to display Woocommerce products list by tag
- Only return taxonomies that are linked to a category & product
- Query WP Posts, then list the taxonomies from those posts
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- Optimal way to make tags in tax_query optional?
- Taxonomy Terms That Don’t Exist Display Results
- Adding additional taxonomies to wordpress taxonomy page
- How to create page that lists tags by initial letter?
- How can I get all the posts that are related with a specific taxonomy term?
- How to combine nested tax_query logic with other nested query logic?
- Query Top Set Custom Taxonomy In Given Timeperiod
- tax_query not working for taxonomy slug
- Get posts of an specific term of a custom taxonomy
- Rewrite rule pagination on different url levels
- Select posts wich has no relationship in custom taxonomy
- How to get hierarchical number of custom taxanomy
- Get newest value of an array
- Add a custom variable to query page object
- Filter custom post type by custom taxomony
- Page displaying 1st post from a range of custom tax?
- WordPress WP_Query Array Custom search via taxonomies
- query_posts problem – need help
- WP_Query and DES sort for Custom Taxonomy based upon a meta field?
- tax_query not working properly with get_posts
- query only direct child and sub-terms of a current term archive
- Get access to all terms associated to each post that the wp_query loop displays
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Give attachments an archive page, and exclude unattached ones
- Custom Taxonomy in custom REST API search
- I’m trying to get posts under a custom taxonomy but I don’t know what I’m doing wrong here
- Display Featured image from custom post type category (custom taxonomy) wise