You can use wp_query()
for this to work
$args = array(
'post_type' => 'auction',
'posts_per_page' => -1
)
$query = new WP_Query($args);
if ($query->have_posts() ) :
echo '<select>';
while ( $query->have_posts() ) : $query->the_post();
echo '<option value="' . get_the_ID() . '">' . get_the_title() . '</option>';
endwhile;
echo '</select>';
wp_reset_postdata();
endif;
Documentation for WP_Query
https://codex.wordpress.org/Class_Reference/WP_Query
Related Posts:
- Query by post title
- Marking future dated post as published
- Fetch All Posts (Including Those Using a Custom Post Type) With WordPress API
- List page for custom post type?
- Sort Order for a Custom Query in a Post Type Archive Not Working
- Display several random posts, but make sure a condition is met
- add_rewrite_rule and custom variable
- Custom post type’s get_permalink returns wrong url
- How to hook get_terms() to only show count of posts that have custom meta
- how do I display a featured image in a post type?
- How can I combine posts of different types in one hierarchy?
- WordPress monthly archive links result in 404
- Not sure why my custom post meta field isn’t saving
- Remove taxonomy slug when not assigning taxonomy with custom post types
- Add extra parameters after permalink?
- How i add new link after Edit | Quick Edit | Trash | View in quick edit section
- wp is not defined error using wp.media to create a custom image uploader
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- Is there a way to list posts of only a certain category
- Remove header and footer but KEEP all css and js etc for a custom post template?
- How loop through posts based on custom fields
- Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type
- Need post_type_archive_title function but in ‘single’
- How do I get the permalink structure to work like this?
- How to get all posts except for one post from a certain custom post type?
- Create a random unique 6 digit number as custom field for custom post type
- Hierarchical Custom Post Types – Show only parent on tax archive?
- Sorting multiple custom post types without a meta key/value pair by sort order
- Remove fields on media uploader for custom page type – not working for “From Computer” or “From Url” tabs?
- Using My-Meta-Box-Class plugin, how is ‘Date’ value stored?
- Custom post types instead of regular post’s categories in a page template
- List children on child post
- Multiple TinyMCE editors in dynamically generated textareas
- How can I set taxonomy programmatically
- WP Storing postmeta into revisions
- Return the latest post from a custom Taxonomy and Post Type
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- post meta parameter in post custom-post-type endpoint with restapi
- Full Custom Post Type List Organised by two Taxonomies
- Filter custom posts by multiple taxonomies
- Create a Custom Post from within another Custom Post
- Custom filter function not working with Custom post type
- dropdowboxes with pre-selected custom fields optios that filters the results according seach needs
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- How can I add a custom field to an existing custom post type?
- Help With Warning on creating new Post types?
- detect your custom post type in WordPress
- Display Repeatable Meta Box Content
- Add tags to custom post type without menu link
- Control content before and after custom post type loop
- Convert comma separated list to serialized array to import as post meta
- Distribute Custom Post in different pages
- Problem with Apply Filters on URL in meta box filed of custom port type
- Archive page for custom post type and custom taxonomy
- Custom loop to query posts with no featured image and/or no post editor content
- Improve Custom Post Permalink Structure
- Custom post type ‘Show on screen’ didn’t apply to number
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Creating custom post type and taxonomy archives and pretty URLs
- How do I add multiple post types to this query?
- Show 10 newest post for each value of a custom taxonomy
- Using custom post type as front home page pagination not working
- Migrate Custom Post Type with Custom Fields data and parent child order
- Archive page for WordPress Custom Post Type doesn’t show pagination from paginate_links()
- How to create review point system for CPTs (many-to-many relationship)
- Query to show post current day
- Using ACF values in nested WP queries for CPT with date values in the past
- SELECT custom post type and its meta in SQL
- Trying to list years (for a filter) but not all years display
- CPT tags not showing when editing post
- Custom post type single page returns 404
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- Add content to wordpress edit.php page
- Assign for all post of a post type a specific single-post template
- Display custom tax in “while” loop
- Show posts under a selected custom taxonomy term
- Overriding a CPT template file through functions.php
- Wrong post ID in meta box callback
- Linking Taxonomies
- help me to display featured image of specific post by post id
- How do I retrieve the title of a term of a custom post type with custom taxonomies?
- 404 custom post type
- Displaying WordPress Parent field in child post
- Get number of posts by a user (draft, pending review & published)
- How can I generate a list of post-type specific categories?
- Custom post tag images not displaying with ACF
- Publish post and create additional posts with same content
- Excluding top level from taxonomy and post loop
- Paginating custom query on category template
- New WP_Query not isolating custom post types on front-page template
- Get a list of categories ids
- Styling first post using Advanced Custom Fields
- Pagination not working on homepage
- A to Z list for custom post types
- What Is My Fault With This WP_QUERY ? [ Pagination Problem ]
- Rewrite nested urls for custom post type
- Custom Post Type featured option
- custom taxonomy not return in the code
- Rewrite rule taxonomy url with different values in one function