If that is all of your code, you’re missing a save_post action to save the data. Refer to the code sample provided on add_meta_box.
add_action( 'save_post', 'save_my_meta_box_data' );
function save_my_meta_box_data( $post_id ){
// make sure it's not an autosave
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// verify your nonce
if ( !wp_verify_nonce( $_POST['my_noncename'], 'my-nonce' ) )
return;
// check post type, permissions
// validate your $_POST data
// update_post_meta();
}
Related Posts:
- post formats – how to switch meta boxes when changing format?
- Adding an assisting editor box to Post page
- Options to get my custom post type metadata via the WordPress API
- Add box with custom per-page properties
- add post meta front end edit
- I can not display meta value in extras.php and template-tags.php
- Add post meta data date to event
- Check if any meta on the post has value then display content
- Get or set values in post meta
- I created a Custom Meta Box but it is not displaying the value on my post page
- update_post_meta() throws Uncaught error: Cannot create duplicate attribute
- Remove action of an external plugin after checking if custom post meta is set
- How we insert values into database using metabox WordPress?
- Post meta box data not saving
- Hide individual page title using checkbox in custom meta box?
- Most efficient way to get posts with postmeta
- What is the index [0] for on post meta fields?
- How to update_post_meta value as array
- What’s the point of get_post_meta’s $single param?
- Get a single post by a unique meta value
- Custom field metabox not showing in back-end
- Trying to get custom post meta through Jetpack JSON API [closed]
- How to get meta box data to display on a page
- Why is get_post_meta returning an array when I specify it as single?
- Add post meta based on another post meta value before publish post
- delete value 0 in post meta [closed]
- Can I safely delete a record, manually, in the wp postmeta table?
- Having trouble with custom post type / meta box
- update custom post type meta from a shortcode
- Exclude a category from the filed under list
- Are multiple values from get_post_meta guaranteed to be ordered?
- How to keep a check box in custom meta box for custom post type checked by default for add new post?
- Custom fields to save multiple values
- Show metabox in custom-post-template depending on taxonomy term?
- Add a post metadata if only the key and value does not exist
- Generate an Email address from that of the Post Author
- Why does get_post_meta not work with the posts page?
- How to get the total number of meta_values based on a custom post type?
- Is there a need for nonce with Post Metabox?
- Does “update_post_meta” check if value is the same before updating?
- Add a meta value if admin , editor or any other user have open a post in edit mode
- Finding the page id
- WP_POSTMETA – What do these values mean inside the data structure?
- Undefined Variable – Custom Post Type Meta
- Update Line Item Meta Data – WooCommerce API
- Unset field from an array not working as expected
- Update post_meta with WooCommere variation data
- What type of index should I use for postmeta?
- Metabox not show in categories custom post type cmb2
- Meta function issue
- Editing does not change post_name
- Compare string with post id in wpdb and do stuff when match is found
- $wpdb class updating meta_value using Ajax [closed]
- How to selected which tags to print, instead of printing the whole tag list?
- query posts and split meta information into separate div’s
- Move Title and the Content WYSIWYG editor position
- “Cannot use import statement outside a module” JS error while adding a custom meta block?
- Gutenberg featured image checkbox – checkbox not correctly set on editing page reload
- How to properly use oneOf and anyOf in Rest Schema?
- Get the author meta adds now
- wordpress is_front_page() issue
- show ad after # paragraphs
- If ACF meta_key has meta_value
- Show value of select dropdown in meta box
- Unable to Call More than One Meta Box Output
- Image not showing using a custom function and get_post_meta
- Function to return values from metabox
- Repeated nav bar queries failing to be cached
- Add a meta field to the list of results for a custom post type
- Randomizing Post Links Outside of Loop – No Author or Date
- help to decipher wp metadata
- Insert Custom Field Value
- Why is $_POST empty when saving custom Meta Box?
- SQL query – get a featured image’s alt / alternative text
- update_post_meta() updating nested array in Multidimensional array with empty sub-array
- How do I list taxonomies that have upcoming events in WP? Is there a way to do this without having to query posts first?
- Sorting my posts on homepage my specific value in post_meta table
- Strict comparisons problem when using boolean post meta
- Why is the actual number of thumbnail images not matching what is store in an attachments metadata?
- Combine meta query and give a specific meta query a higher priority
- Get table parameter and save in meta value
- How can i show post views using specified post ID?
- Allow HTML in Custom Metabox area
- How to add/update post meta to use in query?
- Custom field metabox not showing in back-end
- gettext localization is not working
- Move Entry Meta Above Title in Archives (Genesis + Brunch Pro)
- Exclude category from DB query
- How to sort by meta value num, but ignore zero value?
- Only allow one meta key value per post in a category
- Create a Gallery and update Post Parent of Attachment Images
- Fetch post meta data on POST request
- Which query method to use? (edit- wpdb syntax problems)
- How to update post meta with xml data
- How to display meta box data using “Meta boxes as needed”
- Allow iframe in custom meta box
- Datepicker altField and altFormat to save a new meta key/value in a post?
- CPT posts in drop downed in meta box on page doesn’t return post ID
- How to add new Metadata options (Date, Author, etc.) for Posts?
- Getting author’s nickname as meta value