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
- Creating an Image-Centric Custom Post Type?
- Correctly delete posts with meta and attachments [duplicate]
- Action hook on Edit custom post type?
- Get custom post type by category in a page template
- Associating an “author” with a custom taxonomy
- Add custom field to media attachment image attribute in post editor
- How can i add a metabox to pull list of custom posts (any two) on edit or add post screen?
- Metabox saving values
- Change Post Title Edit Box
- Post Ancestor and Child Post in Custom Post Type
- Multiple information using custom post type
- How to keep a check box in custom meta box for custom post type checked by default for add new post?
- After deleting a post are terms, and custom meta deleted?
- Show metabox in custom-post-template depending on taxonomy term?
- Storing Custom Post Type Data in a Custom Table
- Should I use Custom Post Types or something else
- Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily
- Related links – from other sites
- Extend the wp_get_archives output with ‘?post_type=foo’?
- How to add a “custom” date field to a custom post type?
- Check Title Unique Or Not and If not error message and dont save
- Meta Box Only in CPT Edit Page, Not in Add New
- How can I display custom post types under multiple views?
- Why do I lose the content of meta boxes when I leave the page?
- Populate Custom Fields in a Custom Post Type?
- Duplicate Custom Header Functionality into the post edit screen
- Custom meta box data array: foreach not working correctly?
- How to check post type (to include custom css)
- Troubles with saving metabox
- How to check if user meta field is empty in conditional else statement
- Display only one post each WEEK
- Post Quote with image on header for news site
- How to Create an Image Upload Box for Custom Posts?
- How to store multiple values in 1 meta_key with radio input?
- How to allow visitors to enter custom post type?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- delete_published_posts does not work
- Disable closing on metaboxes
- non-hierarchical post type with hierarchical url structure
- Create a Dropdown from Custom Post Type
- meta box on custom post type
- Listing custom terms in custom post meta
- Best structure / rewrite rules to achieve the following url
- Moving meta boxes in admin
- 404 Error on form submission within custom post type
- Remove Quick edit for custom post type?
- Can I restrict category availability?
- Using custom post type as taxonomy
- Displaying multiple post types on home page
- Conflict between wp_list_pages and get_posts – list pages not displaying
- Metabox multiple custom post select -> display selected items?
- How to export custom post type with ACF to individual file with automation?
- Filter posts of custom post type by meta key in (List All Section)
- Different videos for different posts
- saving dropdown menu data on custom post type
- Set Default Option Value as Blank for Meta Box
- Add Class according to the order of appearance
- Related posts meta_query CPT
- Meta box with front-end styling
- Cannot Save MetaBox Data in Custom Post Type
- Custom post type meta box empty after save
- How to add a class to meta boxes (to customize them in CSS)?
- How to keep a record of changes to a custom field?
- How to create Custom image post?
- Publish box in CPT remove ‘edit’ link
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- Set a Default CPT taxonomy by taxonomy id
- Publish metabox postition?
- Need folder for CPT templates for eg: single-{post_type}.php
- Add other all taxonomies as meta boxes to custom post type
- WordPress deletes custom posts instead of trash them
- Metaboxes in Loop
- Custom meta box data not saving
- Collect custom post in a calendar
- Custom meta-box for all custom post types
- Display all post types together
- Collection of fields in a single post
- Filter CPT based on meta box value using Flexible Posts widget?
- Add Metabox to all custom post types
- What’s the best way to show custom post types? With page template it’s not perfect!
- Creating entries with image attachements within posts and managing them in a list
- How to add custom column to Custom post page list?
- Show search for data extracted from metabox
- Remove custom meta boxes from custom post type
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- is therer any wordpress function to retrieve a specific html element from post content
- My custom meta box with textarea field not saved
- Custom post type URl Cutomization