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?
- Top Level pages in wordpress giving 404, but child pages working fine
- Unable to link categories to custom post type using standard function
- Enable taxonomies by post type in an array of CPTs
- How can I group posts by months and years?
- the_content(); of custom post type treated as an array or object
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- How does the ‘the_post_navigation()’ work for CPT’s?
- Display post from a date range from custom field
- Custom post type – list posts based on meta_key and display them divided by CPT taxonomy category
- Displaying a div from an assigned meta_value when on a page
- Targeting categories in custom fields
- Getting a custom post’s custom field based on another custom post’s custom field select
- WP_Query not resetting after wp_reset_postdata
- Custom post type to lead to single post type instead of shortcode modal
- Filter posts of custom post type by meta key in (List All Section)
- Display post from custom post type
- Query Posts, order by meta value
- Display 1 Post per taxonomy with polylang
- Menu for taxonomies and posts belongs to taxonomy
- How to automatically create a terms based on each post of a post type
- posts_per_page in custom WP_Query does not override “Reading” settings?
- WP Query from two Custom Post type fields as statement
- Display Parent-Child Posts in specific order by comparing IDs in array
- Display post count for a specific month
- Query to Exclude Child Pages from Custom Post Type Archive
- WP_query has incorrect wp_posts.post_name = ‘asc’ when I have custom post type called ‘order’
- Randomizing WordPress Custom Post Type Sorting Through Them Without Page Refresh
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- How to output custom post type title on custom page with category next to it?
- Add custom template ‘sub-page’ to Custom Post type?
- Create custom post type categories
- Custom Post Type Single Page and Archive Page redirects to Home Page
- How to sort by multiple values in a nested WP_Query
- SEARCH QUERIES – REVERSE OUTPUT
- Disable Sidebar on certain pages
- post_type incorrect for custom post type
- how to create custom taxonomy drop downs for parents and child
- Add other all taxonomies as meta boxes to custom post type
- Page with Category Returning 1
- How to get post type archive category title
- Automatically / dynamically populating tags in custom post type
- How to get the posts that my following users are liked?
- Organising custom taxonomies and custom post types
- SQL LIKE in WP_Query
- How can you use a page for a custom post type?
- Filter Term By Parent Term – Custom Post Type
- WP Query with multiple post types ordered by custom meta date then published date
- CPT Efficient way to display posts from different categories with custom query
- How To Loop Through list with Custom Post Types
- CPT or Custom Table for Repository of Serial Numbers
- Different post types arranged on one page
- Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values
- Custom Post Type + Category archive
- List all posts from custom post type by taxonomy
- Values inside a custom field to determine which category posts to display
- WP_Query get posts where post_name is empty
- How do I sort post listing by child post count?
- Pop up showing same content on all posts display.
- Custom post-type’s pagination not working in category.php
- Using custom post types within a section of a template
- Querying meta values within an array
- Count of posts with meta_key filled in?
- Archive page – problem with pagination
- Are custom posts included when getting a categories’ posts?
- Query order by meta value force specific tag first
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- WP Query – Can’t get posts with specific taxonomy
- Query Multiple Post Types and Paginate Newly Created List