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?
- Syntax to get the Nth item in a list of custom post types?
- WP_Query to loop a Custom Field, Custom Post Types do not show
- Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts
- Using Query Posts With Multiple Post Types And A Taxonomy
- How to show posts from multiple post types in a single loop? And display them separately on the same template
- Custom Taxonomy List links being re-written
- Want to filter only parent post in admin area
- Associate Taxonomies Across Post Types
- Display posts if a custom field value is equal to another custom field value
- WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?
- Custom post query by taxonomy
- Relationship between two taxonomies and a custom post type [closed]
- Using global $post; to get featured image for custom post via WP_Query
- Hide specific parent categories from post edit
- Metadata for a taxonomy – is there any WordPress way of doing this?
- Create custom PAGE with register_post_type
- Can’t query tag and post_type at the same time
- Page vs Custom Post Types Differences/Issues
- Converting the_content string to an array?
- Make parts of your wordpress website completely built with data from external APIs?
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Assign same parrent Page to pages AND custom post types
- How do I display the grand child items of a taxonomy term?
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- Top Level pages in wordpress giving 404, but child pages working fine
- Why is get_pages() returning a boolean?
- Unable to link categories to custom post type using standard function
- the_content(); of custom post type treated as an array or object
- Creating two loops based on different logic
- get_category_link() for custom post type does not include custom slug rewrite?
- Getting a custom post’s custom field based on another custom post’s custom field select
- Conflict between wp_list_pages and get_posts – list pages not displaying
- Show message when query has no posts
- Display 1 Post per taxonomy with polylang
- Foreach loop returning more than one item when querying taxonomy
- posts_per_page in custom WP_Query does not override “Reading” settings?
- Display Parent-Child Posts in specific order by comparing IDs in array
- Add custom template ‘sub-page’ to Custom Post type?
- SEARCH QUERIES – REVERSE OUTPUT
- WP_Query to display number of custom post type filtered (order by) taxonomy
- post_type incorrect for custom post type
- Live search by custom tag
- Set a Default CPT taxonomy by taxonomy id
- Custom Post Type – Display all, wrap in groups of 3
- how to create custom taxonomy drop downs for parents and child
- How to get the posts that my following users are liked?
- Only show categories that have posts within custom post type
- How to create groups like that in buddypress?
- How can you use a page for a custom post type?
- Filter Term By Parent Term – Custom Post Type
- Display all Custom taxonomy terms and their relevant custom posts
- 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
- get children from current variable (taxonomy) via shortcode
- Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values
- Custom Post Type + Category archive
- Is it possible to make one of two custom fields in Custom Post Type UI Required but not the other?
- 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
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Count of posts with meta_key filled in?
- Are custom posts included when getting a categories’ posts?
- Query order by meta value force specific tag first
- How can I show posts with the same tag?
- Load posts via AJAX without draft status