Use a function that returns an array of arrays that the options
field expects.
Something like this (untested code):
array(
'name' => 'Test Select',
'desc' => 'field description (optional)',
'id' => $prefix . 'test_select',
'type' => 'select',
'options' => get_myposttype_options('myposttype'),
),
function get_myposttype_options($argument) {
$get_post_args = array(
'post_type' => $argument,
);
$options = array();
foreach ( get_posts( $get_post_args ) as $post ) {
$title = get_the_title( $post->ID );
$options[] = array(
'name' => $title,
'value' => $title,
);
}
return $options;
}
Related Posts:
- How to force one column layout on custom post type edit page?
- Add comments meta fields to comments metabox on post edit screen
- How to add a select menu to this metabox code?
- Having trouble with custom post type / meta box
- Dynamically add / duplicate custom meta in custom post types
- How can I create a custom meta box to add an mp4 video to a page?
- Is it possible to create relational metabox values in a custom post?
- Cannot save CPT meta box
- How to insert data into meta box from another plugin?
- Placing Admin Post Metaboxes in Tabs
- Custom metabox value not saving
- Problems with a custom meta_box
- WP 3.1 – archive pages for custom content types possible now without a plugin?
- Admin Post Update Redirection to Posts Screen
- Remove tabs from media uploader for a CPT
- modify all posts of a category to “no comments allowed”
- How to not allow custom roles to edit published custom post types?
- Assign Page Template Within A Custom Post Type
- Priority of Meta Box for Custom Post Type
- Single Page WordPress CSS and JS links
- 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?
- add_meta_box: Datepicker like the one for postdate?
- [Plugin: Posts 2 Posts] Changing display order of connections
- Disable dragging of metaboxes in custom post types?
- Error after deleting Custom Post Type with a function (no trash used)
- Custom Post Type Meta Boxes
- How to delete all posts from a custom post type?
- Structure for projects and clients
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Using WPAlchemy metabox values in another metabox
- Why is my custom loop not filtering correctly nor paginating?
- Custom post types with custom directories
- Saving repeated option values in a custom query
- How to customize admin posts based on the user who is logged in
- Pull a post based on a meta value in a custom post type
- Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade
- Cannot save Checkbox meta box value from a Custom Post Type
- Group posts by custom post type
- Undefined Variable – Custom Post Type Meta
- Plugin: register custom post types, child ready and performance best practices
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- How to handle paged param in post and custom-post-type?
- 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?
- Shortcode to display Staff post type based on Location post type and Specialty post type
- How to make custom taxonomy into drop down select in a custom metabox
- How to add attributes to taxonomies that may be different from post to post?
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- How to sort posts in a custom post type by title in ascending order by default?
- Add additional field to custom post_type
- Save Multiple Metabox values
- How to Echo Metadata Value in Currency Format
- Problem with $post_id object’s property
- How To Display A List Of CPT Posts In A Meta Box On Menus Page?
- populate array with posts
- WordPress Count posts within a custom post type
- Meta box data is saved but NOT displayed in the meta box text field. Why?
- Custom Post Types and Removing Slugs – should we do it?
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Custom Content Type with No Page View
- Custom post type tags not showing in search
- I can’t connect my custom jquery to wp admin
- Saving meta box data?
- Function to add custom HTML into head in custom post-type list page
- Invalid file type when using wp_upload_bits to upload PDF to a custom post type
- Metabox does not show in custom post type
- What is the best way to manage small blocks of content on my home page?
- One post auto attached to many another items
- One Custom Post Type two different Templates
- Include a metabox in the ‘home’ screen of a custom post type? If not, then the dashboard page?
- How do I “trash” a custom post type post while logged in as Admin
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- How to get custom post type with dynamic ID
- Is it possible to create 2 unique titles for an Events custom post type: Upcoming Events and Past Events?
- Custom metabox with image gallery upload that won’t attach images to post
- wp delete duplicate entries of custom post types every 15 minutes
- Attempting to create custom “post” template, getting a 500 internal server error
- connect users to Custom post types
- How to retrieve custom post type permalink in another cpt?
- Custom Pagination based on Custom Post Type
- Custom user roles
- One Post with different content, depending on a Page
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Custom Post Type
- do action inside a class is not working
- Registering an optional custom post type from a plugin
- 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
- Yearly Archive from a custom date metabox (Event Start Date)
- loop through custom post-type with two meta_keys
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Inserting two categories
- CPT Template Option to Top
- Use a Variable in update_post_meta as the $meta_key
- Advise on Custom Taxonomies and Structure