use these:
$imgurl = isset( $values['upload_image'] ) ? esc_attr( $values['upload_image'][0] ) : '';
<input id="upload_image" type="text" size="36" name="upload_image" value="<?php echo $imgurl; ?>" />
<input id="upload_image_button" type="button" value="Upload Image" />
if( isset( $_POST['upload_image'] ) )
update_post_meta( $post_id, 'upload_image', wp_kses_data( $_POST['upload_image'] ) );
Related Posts:
- Add “upload media” button in meta box field
- Add a Meta Box for uploading a SECOND Featured Image?
- WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins
- How To Remove The “+ Add New Category” Link From A Category Metabox
- Removing Metabox for “Slug” without removing functionality
- Attach Files Metabox
- Adding uploaded images to editor from metabox instead of default popup uploader
- I need a Simple image uploader with a simple screen. WP default has too many options.
- Customize WordPress Media Upload and New Media Manager Menu in add post Metabox
- Setting multiple image urls using WordPress’ Media Uploader
- Problem with meta box in Links
- How to modify Publish metabox?
- I’m using add_meta_box() but want to include TinyMCE editor *and* Media Uploads for each box
- WPAlchemy MediaAccess inserting media link in WP Editor instead of custom field in metabox [closed]
- Set default value for radio button in WP Alchemy custom meta box?
- My custom write panels won’t save data. What am I missing?
- How to add meta box for image upload using WordPress media uploader?
- Insert media button will always add into the same tinyMCE editor
- remove a single post_meta
- save meta data of custom post type: WP_Error has no effect, even if insufficient capabilities
- Custom meta box using OOP way doesn’t save data
- Generating image sizes when uploading through wp.media
- Upload button in metabox not working
- Select Options Meta Data is Not Updating in Edit Meta Box
- Create more Meta Boxes as needed
- Set Default Admin Screen options & Metabox Order
- How to set default screen options?
- Passing error/warning messages from a meta box to “admin_notices”
- Specific upload folder for PDFs in custom Post type in WP multisite
- Does WordPress have a “Form API”?
- Metabox with checkbox is not updating
- How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button
- What is the “Advanced” $context in add_meta_box?
- Removing panels (meta boxes) in the Block Editor
- Change The Title Of a Meta Box
- How to make open/closed and hidden/shown metaboxes status saved on a per-post basis?
- How can I create a taxonomy meta-box with search suggestions but no new terms input?
- Remove the Featured Image Meta Box
- Remove the Yoast SEO Post Metabox [closed]
- Make Custom Metaboxes Collapse by Default
- Best practices for meta box placement?
- Creating a metabox to upload multiple images
- How Does WordPress Remember Metabox Positions?
- Sample code for validating custom metabox?
- Post custom metabox textarea using wp_editor
- How to force one column layout on custom post type edit page?
- How to Add Reminders/Notes to New Post Meta Boxes
- Can upload doc and pdf but not ppt – not permitted for security reasons
- How do I get attachment_id?
- Rename UPLOADS folder with custom WP_CONTENT_DIR
- How to reorder meta box position?
- Remote upload file to server B
- Prevent sorting and dragging of specific postbox metabox
- Check for and enforce unique value in user-entered custom meta field in WP Admin
- One metabox for multiple post types
- How do I position meta_box on post edit screen after the title?
- Using Images in WordPress – Best Practices
- How to add a class to meta box
- How to move wp-content (or uploads) outside of the WordPress directory
- Has anyone successfully integrated qtranslate with custom metaboxes?
- Put the media uploader in a metabox
- Limit Media Library to Given Folder
- Custom Meta Boxes: multiple fields within a repeatable field
- Removing meta boxes: remove-meta_box() or unset()?
- Upload multiple images in a custom metabox
- Save checkbox value in metabox
- How to group meta boxes on the post edit page
- Use meta box drag and drop to order items independently
- Adding another state (spam, reject, approve) to wordpress comments?
- inside a metabox
- Add Meta box Befoure Post Title
- Hiding a theme’s meta box
- Metabox date month number to word
- get registered metaboxes by post type or post ID
- Remove metabox from specific page template in admin
- Is there a filter/action to add content to WP admin metaboxes?
- CMB2 metabox conditional logic
- Adding upload button in metabox
- Using media-upload.php to upload mp3 via custom fields
- Tinymce/WordPress is removing all line-breaks?
- How do I create a meta box for dates?
- Adding submit or update button to custom metabox?
- Editing the Default Links like “Site Admin” in the Sidebar Meta Section?
- How to pass variable via $callback_args for add_meta_box
- Add metabox with media uploader in a custom post type [duplicate]
- Undefined function error when creating Custom Meta Box
- How to get meta box data to display on a page
- esc before saving or before displaying does it matter?
- Block metabox – No expanding, no moving around
- Remove tabs from media uploader for a CPT
- Move excerpt to always be directly below post content in admin
- Access the environment of an admin page from another admin page
- Add a meta description to home page?
- Editing Screen: Make Update or Publish Button Follow The Page
- Removing custom meta box added in parent theme
- front end post with multiple upload images?
- Add filter ‘wpautop’ to meta box textarea
- Use meta box value in CPT as post title
- Custom “Publish” / “Update” button &
- Why can’t I hook into save_posts after admin_init?