Amusingly, the codex for wp_dropdown_pages includes this:
It is possible, but not confirmed, some of the paramters for the
function get_pages could be used for wp_dropdown_pages.
This must be at least partly true as I assume your use of post_type
as an argument is successful. That being the case, give exclude
a shot too.
In your companyList
loop, build an array of post IDs to exclude:
$name=$post->post_title;
echo '{ value:'.get_the_ID().', label: "'.get_the_title(get_the_ID()).'"},';
$exclusions[] = get_the_ID();
Then just throw that argument into your wp_dropdown_pages
:
$args = array (
'id' => 'house',
'name' => 'house',
'echo' => 1,
'post_type' => 'house',
'exclude' => $exclusions
);
Related Posts:
- Query Custom Post Type taxonomy type based on page
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- How to get the parent’s taxonomy?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- List all custom post type posts from a given category?
- Show Post Count of a Category
- tax_query returning all posts instead of selective posts in WP_Query
- Fetch taxonomies by custom post type id array
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- How to show CPTs in term archive
- Custom post taxonomies as tax_query terms?
- Several post types on WP Query by tag and taxonomy
- Variable not working in WP_Query
- Query all post and CPT from 2 specific taxonomies AND by ACF custom field
- Sort results without WP_QUERY?
- Running a custom query inside another cpt single and trying to grab a variable
- Get posts by category name
- Query Custom Post Type by Taxonomy
- Page that lists publications by classifying them by taxonomy
- Display related CPT with custom taxonomy
- Filtering posts based on three taxonomies
- Display Custom Post Type Based on Taxonomy With WP_Query()
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Custom Taxonomy – fields
- One of my headings is mysteriously coming up as a link in my CPT Archive
- Query for a custom post taxonomy
- Displaying WordPress posts from post and custom post type in custom taxonomy
- How to display elements of different post types?
- category_name not working in WP_Query
- How to store queried custom data and use it in multiple pages?
- How do I hide single category post on my post page
- How do I get parameters from the URL?
- How to display posts from home page in blogs in category wise
- Display CPT posts based on specific taxonomy
- Can’t query tag and post_type at the same time
- Setting proper query for multiple custom admin filters
- Making a custom help center page
- shortcode to show custom post types by category
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- Tag page with Custom Post Types not returning any posts
- Unable to retrieve any posts of CPT in wp-admin
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- WP_Query: include custom post type only with specific meta value
- Pagination on a custom post type loop
- Display all posts in main category and 1 subcategory
- showing custom post types of a certain category only
- WP_Query orderby modified to include custom meta changes
- WordPress custom loop filter by meta_key and value with serialize data
- Update permalinks when new category added to custom post type taxonomy
- create a template page for a post
- Returning a list of custom post types excluding those without a specific meta_value
- query private custom post type
- Display custom post type from dynamic custom field
- Query/list all terms and their custom post count
- Linking to the most recent post in a Custom Post Type
- How to make sure content doesn’t display if selection is empty
- Show category ID on custom post type
- Filtering WP_Query Dynamically on the Front-End
- wp_get_post_terms on custom post type with custom taxonomies returning an empty array
- Show one item per category of a custom post type
- Page vs Custom Post Types Differences/Issues
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Storing posts from query and accessing later via AJAX call
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Genesis filterable portfolio isotope [closed]
- Query custom post type with tags
- wp_query check if integer exists in custom field’s array
- convert custom query to wp_query
- Wrong request query on cpt and tax
- Custom Taxonomies not appearing in Admin
- Previous/Next Link by Meta Value in CPT
- Show custom post type filtered by category
- Randomize Posts. Skip the first post in ascending order
- Creating a navigation menu of all posts of a custom post type and their children posts?
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Filtering WP_Query
- Custom Post Type Set Comments ON by default without show METABOX
- Search / Filter posts on Title/Content OR Tags
- Pagination on with query_posts in custom post type template
- Custom Post Type Taxonomy Filters
- Wp_query: sort by PHP variable
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- How do I do this with WordPress? Taxonomies?
- Custom-Posttype & Custom Taxonomy WP_Query
- Crafting WP_Query array, sort by date
- Custom loop with multiple taxonomy queries
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Converting the_content string to an array?
- forming WP_Query for posts of all post types but from specific categories
- Is using taxonomies the way to go here or would custom post types be better?
- Get latest 3 posts from multiple CPT in one query
- Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”
- Using default WP menu functionality to link to custom post-type listing?
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Display upcoming Events for next 7 Days
- Can taxonomies of custom post types be used with category actions?
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?