Of course it is possible.
Below is code that will display registered post types:
function my_meta_box_add() {
add_meta_box( 'my-meta-box-id', 'MY meta', 'my_meta_box', 'page', 'normal', 'high' );
} add_action( 'add_meta_boxes', 'my_meta_box_add' );
function my_meta_box( $post ) {
?>
<p>
<label for="my_meta_box_post_type">Post type: </label>
<select name="my_meta_box_post_type" id='my_meta_box_post_type'>
<?php $post_types=get_post_types('', 'objects'); foreach ($post_types as $post_type): ?>
<option value="<?php echo esc_attr($post_type->name); ?>"><?php echo esc_html($post_type->name); ?></option>
<?php endforeach; ?>
</select>
</p>
<?php
}
Of course you have to take care of saving this value, checking nonces, and so on.
Related Posts:
- Multiple Custom Metabox Help
- wp_dropdown_categories in custom post type with custom taxonomy
- How can I add a column/s to wp_posts table?
- Find callback function for custom taxonomy metabox
- Remove custom metaboxes from custom post type
- Add pre-existing meta box to new custom post type
- Dynamic page.php template for custom post types
- Add special meta box to custom post type
- Custom field values get deleted
- WordPress metabox file upload in custom post [duplicate]
- Display metabox conditionally
- Adding Custom Metaboxes to Custom Pages
- Save or update data when custom post published
- Custom metabox translation
- How to stop wordpress from mangling HTML in a metabox textarea
- Hiding Metabox from Screen Options Pull Down
- How to add multiple featured image in meta box in post editor?
- Timepicker-addon doesn’t show – Datepicker works fine?
- Adding Meta Boxes while Registering a Post Type in a Class
- Metabox Populated with a Custom Post Type – How to Output CPT based on Select?
- Is it possible to create a post using a metabox?
- Custom Post Type Metabox – Not Saving
- WordPress custom meta field for custom post not storing data
- How to Duplicate (multiple meta box)?
- List of Posts in a Custom Field
- Push metadata in array
- Add Standard Page Attributes Metabox for Page Parent
- dynamically add a custom field or metabox to custom post type [duplicate]
- Make metabox of custom post type fully autosave- and bulk-/quick-edit compatible
- Custom Post Type uses Custom Tags in add_filter?
- Custom date changer post_date => future – missed schedule error
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- Display correctly using metabox.io
- Translating custom post type metaboxes [closed]
- Adding a metabox on a CPT’s submenu page
- How to Add multiple instance of meta box to custom post type
- Ordering values entered in Custom Taxonomies
- Permalinks: custom structure for taxonomy – tags?
- Custom Post Type & Meta Box – Displaying meta box information on front end?
- Global custom meta box
- Sizing textarea field in custom metabox
- Add a custom meta box for client to order CPT posts how they want
- Use remove_meta_box conditionally on custom post type
- create custom meta box with default value
- Issue on Working with Metabox – Checkbox to enable Sale Items
- wysiwyg editor don´t export paragraph
- How to make a meta box?
- Forms and WordPress Nonce
- Why do I have to press the “Update” button twice to save my meta box values?
- Inefficient Query Confusion
- Prevent custom post type from showing up in custom menus
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- link featured image to external link
- Odd behaviour for the update button when displaying a WP_List_Table
- Creating alternate meta box context locations
- wp_editor for custom post type doesn’t save value
- Showing a meta box in a custom post type on a page
- Having Issue on Getting Metabox Checkbox Value
- Custom meta box in custom post type not working
- Multiple wp_editor instances in custom post type using Ajax
- WP_Meta_Query object with conditionals
- I can’t connect my custom jquery to wp admin
- Saving meta box data?
- Updating post content and custom fields in edit post screen
- Add a class to post_class if more than one post shares same meta_value_num
- Function to return values from metabox
- Invalid file type when using wp_upload_bits to upload PDF to a custom post type
- Add a meta field to the list of results for a custom post type
- Metabox does not show in custom post type
- One Custom Post Type two different Templates
- Create a custom post type based on ‘Post’
- How do you make relational post types in WordPress? [duplicate]
- Include a metabox in the ‘home’ screen of a custom post type? If not, then the dashboard page?
- Placing Admin Post Metaboxes in Tabs
- Wp Meta Query does not work while simple Query Works
- How to get custom post type with dynamic ID
- Custom metabox with image gallery upload that won’t attach images to post
- Problem with multi checkboxes value in metabox?
- Getting data from dynamically allocated metaboxes within a custom post
- Wp Query sort order from custom MetaBox
- check_admin_referer not working in custom meta box for custom post type
- How to retrieve custom post type permalink in another cpt?
- Custom meta box in editor of custom post type not working
- do action inside a class is not working
- How to add a custom meta box below publish box in CPT that is like publish meta box and can contains html?
- Search form to find custom meta box generated data
- Edit post meta direct from post.php?
- How to Arrange Support => Thumbnail
- Add different meta box based on taxonomy
- Custom metabox value not saving
- Yearly Archive from a custom date metabox (Event Start Date)
- Need to build custom metabox select prev posts by category
- How to bring custom meta boxes to custom post types?
- Customized featured image doesn’t refresh in post admin metabox after upload/insert
- Saving custom metabox data with a twist
- loop through custom post-type with two meta_keys
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- CPT Template Option to Top
- Use a Variable in update_post_meta as the $meta_key
- Canot save post if any meta box was empty