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:
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- Action hook on Edit custom post type?
- Remove tabs from media uploader for a CPT
- Find callback function for custom taxonomy metabox
- Add special meta box to custom post type
- Custom field values get deleted
- Priority of Meta Box for Custom Post Type
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- How to save the checked boxes?
- Adding Custom Metaboxes to Custom Pages
- add_meta_box: Datepicker like the one for postdate?
- Save or update data when custom post published
- Custom metabox translation
- Custom Post Type Meta Boxes
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Using WPAlchemy metabox values in another metabox
- Dynamically add / duplicate custom meta in custom post types
- Custom Post Type Metabox – Not Saving
- How can I create a custom meta box to add an mp4 video to a page?
- List of Posts in a Custom Field
- Pull a post based on a meta value in a custom post type
- Change meta box when the page’s template is changed
- Cannot save Checkbox meta box value from a Custom Post Type
- Undefined Variable – Custom Post Type Meta
- Add Standard Page Attributes Metabox for Page Parent
- Custom date changer post_date => future – missed schedule error
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Metabox not show in categories custom post type cmb2
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- pre_get_posts for custom page builder meta box
- How to make custom taxonomy into drop down select in a custom metabox
- Translating custom post type metaboxes [closed]
- How to Add multiple instance of meta box to custom post type
- Using POST method in meta box, no results
- Listing custom terms in custom post meta
- Can custom fields be added without a meta box?
- Can’t publish custom post type – “You are not allowed to edit this post.”
- Meta Box on Custom Post Type not saving
- Moving meta boxes in admin
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- custom post type metaboxes not saving
- Custom post type, have only my meta boxes
- Display Repeatable Meta Box Content
- Can I restrict category availability?
- Displaying a div from an assigned meta_value when on a page
- Saving Meta Data within Custom Post Type
- Values from meta-box not on $_POST
- Metabox multiple custom post select -> display selected items?
- Custom post type suddenly stoped working after WordPress 5 update
- Get id from metabox dropdown
- Custom posttype content metabox
- Reusable metabox backend and frontend
- Filter posts of custom post type by meta key in (List All Section)
- How can I output WPAlchemy repeating fields meta values in my page template?
- How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?
- Meta box data not saving
- saving dropdown menu data on custom post type
- Set Default Option Value as Blank for Meta Box
- Questions regarding add_meta_box()
- Related posts meta_query CPT
- Meta box with front-end styling
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Custom post type meta box empty after save
- How to add a class to meta boxes (to customize them in CSS)?
- Problem On Retrieving Post Meta Data on Custom Column [closed]
- Custom MetaBox : Food Menu Item Available Dates
- how to compare different timestamps in wp-query for events custom post types?
- Metaboxes inside Tab
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Create post meta box that links another post
- Show a custom post title in another custom post type in Meta box
- Modify Publish Metabox location on CPT
- PHP Warning with Custom Fields
- Custom taxonomy with custom post type archive page
- Simple Data picker meta box
- Wrong post ID in meta box callback
- Metabox messes up permalink
- How to shows CPT which has specific meta key?
- Render the metabox input values as HTML
- wp_dropdown_pages doesn’t allow me to select more than one custom post type
- Delete custom post type metadata without deleting the post in admin area
- Metabox is not saving
- How to check if meta box value is false for all posts then do something based on that
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Repeatable WordPress custom fields in a metabox
- Display a post count from a custom metabox selection
- Select custom post by meta value
- Make meta box appear if the previous if not empty?
- Custom post type – permalink
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- How to query custom post then display sections by meta value
- Post AND page parameter for WP function
- Add text to metabox input text field from Thickbox
- Display div based on Group metabox selection [closed]
- Multiple posts selection [closed]
- Cannot change meta box position
- Just the First Metabox what saves the data!
- Can’t retrieve custom post type taxonomy term to custom post type editor