Try something like this. I haven’t actually done this yet, it is something I was looking into, so please let me know how it goes.
add_action(‘wp_dashboard_setup’, ‘custom_dashbox’);
function custom_dashbox() {
global $wp_meta_boxes;
wp_add_dashboard_widget('widget_slug','Widget Name', 'widget_display','widget_submission');
}
function widget_display() {
echo '<input type="text" name="youtube_id" /><br/>
<input type="submit" name="submit_youtube" />';
}
function widget_submit() {
//Do what you need to do with your youtube id possibly:
if (get_option('youtubeid'))
{
update_option('youtubeid',$_POST['youtube_id']);
}
else {
add_option('youtubeid',$_POST['youtube_id']);
}
}
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
- Priority of Meta Box for Custom Post Type
- How can i add a metabox to pull list of custom posts (any two) on edit or add post screen?
- How to add a select menu to this metabox code?
- 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?
- Metabox saving values
- Having trouble with custom post type / meta box
- add_meta_box: Datepicker like the one for postdate?
- update custom post type meta from a shortcode
- Calculate Repeater Meta Box Input Field Values and Display Total
- Change Post Title Edit Box
- Custom Post Type Meta Boxes
- 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?
- Show metabox in custom-post-template depending on taxonomy term?
- get_terms won’t display product_cat or any other custom taxonomies when specified
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Using WPAlchemy metabox values in another metabox
- Display custom post on home page based on a metabox selection
- How to add a “custom” date field to a custom post type?
- adding checkbox to meta
- Meta Box Only in CPT Edit Page, Not in Add New
- Why do I lose the content of meta boxes when I leave the page?
- 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?
- List custom post types in metabox
- Pull a post based on a meta value in a custom post type
- Populate Custom Fields in a Custom Post Type?
- Change meta box when the page’s template is changed
- Duplicate Custom Header Functionality into the post edit screen
- Cannot save Checkbox meta box value from a Custom Post Type
- Custom meta box data array: foreach not working correctly?
- Undefined Variable – Custom Post Type Meta
- Troubles with saving metabox
- How to check if user meta field is empty in conditional else statement
- 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?
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Plugin – Combine Meta Box Input Fields into single saveble record
- 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
- Disable closing on metaboxes
- Cannot save CPT meta box
- How to make custom taxonomy into drop down select in a custom metabox
- Create a Dropdown from Custom Post Type
- 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
- How can I move (or create another) publish button?
- Wrap meta boxes & data handling for specific post types in classes?
- Sizing textarea field in custom metabox
- Meta Data for Custom Post Type not saving
- Remove “show sharing buttons” metabox Jetpack from custom post type
- Custom Post Meta from custom metaboxes is randomly being deleted
- Custom post-type metabox position
- 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.”
- What do the numbers mean at the end of add_action(‘save_post’)…?
- A meta box (in a custom post type) with two different type of fields
- How can I set a meta value that will then affect other post meta values?
- Custom Meta Box returns no HTML
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- Removing numerous Meta boxes from numerous CPTs
- Get custom term meta problem on single post type
- Is it possible to sort metabox teaxtarea values?
- wp_editor for custom post type doesn’t save value
- Save Metabox Custom Field Value
- Adding an extra parameter [string] to my posts’ permalink?
- CMB select with data from CPT
- List of all posts in one custom post type in the edit screen of another
- Select Venue from dropdown list and reuse stored address information in meta_box
- Custom Meta Box with variable number of fields
- Save Custom Post Value
- Metaboxes inside Tab
- Custom Metabox Info Not Saving
- Metabox collapsed by default
- PHP Warning with Custom Fields
- Multiple useres editing specified content
- $_POST from a Meta Box
- Wrong post ID in meta box callback
- Convert Custom Post Data to Javascript Array for Autocomplete
- Generating Custom Post Type list, within admin of another custom post type
- Avoid another meta box in my custom post type
- How can i embbed two different galleries in custom post type
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Custom post type in submenu with custom meta box as a title with custom html
- 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
- CPT Metabox with email notification
- Move title “meta box” in post mode
- My custom meta box with textarea field not saved