After getting the posts you can easily put them in another array & then return that array
function get_sponsors()
{
$args = array(
'numberposts' => -1,
'post_type' => 'movies'
);
$my_movies = get_posts($args);
$options = array();
foreach($my_movies as $m)
$options[$m->ID] = array(
'label' => $m->post_title,
'value' => $m->ID
);
return $options;
}
Related Posts:
- Is it possible to sort metabox teaxtarea values?
- I’m having trouble with Related Product “tax_query” ‘terms’ value
- Show Custom Post Type meta boxes only on Page Edit
- Cannot save CPT meta box
- How to make custom taxonomy into drop down select in a custom metabox
- Adding Page Templates to post but it ignored it
- ‘exclude’ argument is not working with get_posts for a custom post type
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- How to get the intersection of two terms both from different custom taxonomies
- Create a Dropdown from Custom Post Type
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- Translating custom post type metaboxes [closed]
- Adding a metabox on a CPT’s submenu page
- Fixed values for same post translations
- How to Add multiple instance of meta box to custom post type
- Edit Custom Post Type on Custom Admin Page instead Post Admin
- Using POST method in meta box, no results
- meta box on custom post type
- Checking if $_FILE isset for an array of file upload metaboxes
- Ordering values entered in Custom Taxonomies
- Listing custom terms in custom post meta
- Permalinks: custom structure for taxonomy – tags?
- Custom Post Type & Meta Box – Displaying meta box information on front end?
- How can I move (or create another) publish button?
- Wrap meta boxes & data handling for specific post types in classes?
- 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
- Custom “radio button meta box” not saving correctly
- Global custom meta box
- Sizing textarea field in custom metabox
- Moving meta boxes in admin
- Meta Data for Custom Post Type not saving
- Remove “show sharing buttons” metabox Jetpack from custom post type
- Add additional field to custom post_type
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- Custom Post Meta from custom metaboxes is randomly being deleted
- Reworking function for counting custom post type posts count
- Get only used meta_values
- custom post type metaboxes not saving
- Add a custom meta box for client to order CPT posts how they want
- Number of posts in the archive
- Custom query for custom post_type
- Save Multiple Metabox values
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- Custom post type, have only my meta boxes
- Display Repeatable Meta Box Content
- Use remove_meta_box conditionally on custom post type
- create custom meta box with default value
- Can I restrict category availability?
- Create metaboxes based on custom post type
- Displaying a div from an assigned meta_value when on a page
- Save and user submitted data from a form and display them in the wp backend
- Custom post-type metabox position
- How to Echo Metadata Value in Currency Format
- Issue on Working with Metabox – Checkbox to enable Sale Items
- How to add editable/dynamic values to dropdown of a Custom Post Type Meta Box
- Custom Meta Box Causing Error: “Are you sure you want to do this? Please try again.”
- Problem with $post_id object’s property
- How To Display A List Of CPT Posts In A Meta Box On Menus Page?
- What do the numbers mean at the end of add_action(‘save_post’)…?
- Saving Meta Data within Custom Post Type
- A meta box (in a custom post type) with two different type of fields
- Set a hard-coded page-template (post-type-archive) as home/front-page of my wordpress blog?
- Using custom post type as taxonomy
- How to Make infinite loop of post
- wysiwyg editor don´t export paragraph
- How to make a meta box?
- Retrieving meta-box from a custom-post-type
- Forms and WordPress Nonce
- How can I set a meta value that will then affect other post meta values?
- get_posts seems to be skipping the last Post
- Why do I have to press the “Update” button twice to save my meta box values?
- Inefficient Query Confusion
- Create a custom post type for a photo post
- Displaying multiple post types on home page
- Prevent custom post type from showing up in custom menus
- Conflict between wp_list_pages and get_posts – list pages not displaying
- How to insert data into meta box from another plugin?
- Unable to display selected post title in frontend from metabox wp_dropdown_pages()
- Values from meta-box not on $_POST
- Return number of all custom posts type by author in all statuses
- Custom Meta Box returns no HTML
- Metabox multiple custom post select -> display selected items?
- Topic won’t save for a custom post type — how to debug?
- Custom post type suddenly stoped working after WordPress 5 update
- Get id from metabox dropdown
- Is it possible to use array_walk() to append terms to an array of posts?
- custom hierarchical taxonomy and custom post type list contains surplus posts
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- CMB2 metabox create select with list of post from CPT
- Display metaboxes if checkbox ir marked
- Custom posttype content metabox
- link featured image to external link
- Removing numerous Meta boxes from numerous CPTs
- Reusable metabox backend and frontend
- Odd behaviour for the update button when displaying a WP_List_Table
- Get custom term meta problem on single post type
- Filter posts of custom post type by meta key in (List All Section)
- Creating alternate meta box context locations