You can get the Packages of the current Proposal using wp_get_object_terms()
and then pass some/all of those into a WP_Query
.
$terms = wp_get_object_terms( $post_id, 'packages', array( 'fields' => 'ids' ) );
$args = array(
'post_type' => 'proposals',
'tax_query' => array(
array(
'taxonomy' => 'packages',
'terms' => $terms
)
),
);
$related = new WP_Query( $args );
If the current Proposal has multiple Packages, this will return a list of Proposals in any of those Packages. You can add 'operator' => 'AND'
to the WP_Query
$args
to restrict it to only Proposals in all the same Packages.
Related Posts:
- Get posts by querying taxonomy and certain terms of the taxonomy?
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- Get terms by taxonomy AND post_type
- Get Posts by Custom Post Type ,Taxonomy, and Term
- Get The Post Type A Taxonomy Is Attached To
- Taxonomy: Why ‘with_front’ => false DOES NOT WORK?
- Display current taxonomy term when inside custom post type
- Get term slug of current post
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Assign posts to taxonomy terms instead of the taxonomy terms to posts?
- How to limit the number of terms (terms acts like categories)
- How do I list custom taxonomy terms without the links?
- query multiple taxonomies
- wp_set_object_terms() is not replacing term, but creating a new one
- Get terms that contain posts that in turn belong to other terms?
- wp_insert_term doesn’t work with custom post type’s taxonomy
- Custom Taxonomies Terms as Post Title for Custom Post Types upon Publishing
- wp_get_object_terms(): count relative to passed IDs?
- Retrieve single term slug
- Exclude from search all custom posts which are NOT in a taxonomy term
- Not Able to Insert Taxonomy Term Using wp_insert_post()
- array_pop() expects array, boolean given for $event_type_term ->slug
- How can I add programmatically custom taxonomy terms to a custom type post when saving posts?
- post count is wrong when using same taxonomy for 2 different CPT
- Custom SQL Query on Custom Post Type. Order by Taxonomy?
- Glossary with Custom Post Type
- Custom Post Type Archive Template
- Maintaining strict one-to-one association between terms and custom posts
- Displaying custom post type by first letter through custom taxonomy
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- If on term-page -> get the current term?
- Separate Custom Post Type Taxonomy by Comma
- Sort the main query in subcategories/terms?
- Trouble adding custom featured image for custom taxonomy TERMS
- Get child terms of current term of the current post
- Get list of terms of current taxonomy archive for another taxonomy
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Get all taxonomies for all post types
- Get the terms of a custom taxonomy for a specific author in author template
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- Dynamically create/remove terms in taxonomy when custom post type is published/trashed
- Paginated Taxonomy Term Archive including one post per term
- How to get the first term for the current taxonomy?
- How do I provide a “show all posts” link in a paginated term archive?
- Output the content of a term organised by each of the CPT?
- How to filter the taxonomy terms based on another taxonomy term
- How to get posts from multiple custom post types according to it’s custom taxonomy terms?
- How to output wordpress custom tags separated by comma?
- How to check the terms in single custom post type template
- Displaying a custom post types custom taxonomy value?
- get_the_terms return only last term
- $wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies
- Does WordPress limit the length of slug names for Post Meta or Terms?
- get_post_meta returns empty array for terms
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Update post terms with custom taxonomy
- How do I display tags for a custom post type single page?
- Custom Post Type Archive Page Filtering
- Filtering WP_Query Dynamically on the Front-End
- Get template part using a custom taxonomy term
- How to restrict users and admin from creating new taxonomy terms?
- Custom post type templating problem
- using $wpdb to get custom post type with term
- Custom Post Type Taxonomy Filters
- Show posts from two or more custom taxonomy terms
- Allow user to set custom order to a list of custom taxonomies?
- Displaying custom taxonomy in the admin list of a custom post type
- Which post does a taxonomy term belongs to?
- Display post as term id
- How do I display the taxonomy term alongside the post type post title?
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Post count by month of taxonmy term
- How do I display the taxonomy for a custom post type in an array
- How to conditionally redirect to the post from a taxonomy page?
- Display Custom Taxonomy Alphabetically
- How do I require the specification of term in a custom post type and custom taxonomy?
- Custom Post, set object Taxonomy terms in plugin
- Get terms that contain posts that in turn belong to other terms?
- How to get custom posts sub category link
- Custom while loop for hierarchical display of a taxonomy
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Display taxonomy terms, child terms and posts in a template
- How to group posts and get a mixed posts and groups view?
- Use custom walker to add taxonomy terms to main nav menu
- Add term to custom post type on draft
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- Listing all term items alphabetically / sorting loop
- How to get WordPress term attached to the Post?
- Query posts with double taxonomy
- Adding predefined terms to a taxonomy
- Get parent category id from child category page for custom taxonomy
- How to get only child terms from a custom taxonomy of current post type?
- Custom query – get_the_terms not work
- How to list tags from custom post type attachments?
- How to Display Posts From Category Within a Custom Taxonomy?
- Custom Post Types Archives and Single Pages not showing custom taxonomy data
- Shared terms between taxonomies
- Get terms of a post but only if they’re also the child of a specific term
- How to get_term_meta on single custom post?
- The Difference Between Categories and Tags and Taxonomies and Terms