This isn’t a WP question, but moreso a general form issue. Regardless, a checkbox will not pass anything if unchecked, and 1
or on
if checked.
// Sanitize user input.
$my_data = $_POST['home_slider_display'] ? true : false;
// Update the meta field in the database.
update_post_meta( $post_id, 'home_slider_display', $my_data );
Related Posts:
- How to set default screen options?
- Does WordPress have a “Form API”?
- What is the “Advanced” $context in add_meta_box?
- Change The Title Of a Meta Box
- How do I get attachment_id?
- Hiding a theme’s meta box
- Block metabox – No expanding, no moving around
- Access the environment of an admin page from another admin page
- add_meta_box does not go ‘side’
- Getting jQuery sortable items in custom metabox
- How do I stop HTML entities in a custom meta box from being un-htmlentitied?
- meta content on required pages
- Create a page Meta Box listing all blog users
- remove_meta_box for all post types doesn’t seem to work
- Position right sidebar metabox right below the publish metabox?
- MetaBox Layout for all users
- How to store multiple input values with same meta_key
- post-excerpt not one of the options under screen options
- How to remove/hide the predictive autocomplete popup when I type in the tag/term metabox
- make a excerpt on data from a meta box?
- metabox upload file
- How to put Periods and Spaces for Array Values (Meta Key)
- How to add a SAVE button to replace PUBLISH on a custom post type?
- Why does get_post_meta not work with the posts page?
- Convert textarea with wp_editor
- Repeatable custom meta fields
- Get all meta boxes values
- Metabox saves on Update or Publish, but not on Saving Draft
- metabox with custom post type values
- Checkbox on a meta box using CMB2 Plugin
- Decide Metabox Configurations for All Users
- metabox select – frontend display
- Set default post author to none on new post
- How to detect if metabox content was updated by the user
- how to save and get selected item id list with add_meta_box
- Remove anchor tag from meta box link
- Adding metabox to wordpress plugins menu page
- How to add select list to meta box field?
- Get meta fields by meta box id
- cannot grab post meta from extended Walker_Category class properly
- How do you List all Sidebars in a Metabox
- Create more Meta Boxes as needed
- Condition display metabox in case the post is saved
- Save meta value as an array of arrays
- Add a meta box to ALL Pages
- How to remove some metaboxes for CPTs?
- How to add metabox ONLY to specific WooCommerce product type [closed]
- Add metabox without the container
- input radio ‘checked’ saves, but select option ‘selected’ doesn’t
- wpalchemi metabox doesn’t show value from my post type
- HTML Table creator in metabox to put into post theme
- edit_page or edit-pages for current_user_can()?
- Editor meta box Showing but not saving
- How can i get multi checkboxes value in metbox?
- Insert media button will always add into the same tinyMCE editor
- Change the title of an Administration Panel
- echo the value of a a meta select box
- save radio button selection in post-meta on submit
- How to display multiple $meta_boxes into separate tables
- ShortCut on meta boxes
- How to add a textarea to only one of the fields of this custom metabox?
- Post edit screen: How to check if meta_box is registered?
- Custom Meta Data is not being saved
- how to update post content field in wordpress
- How to ‘clone’ select metabox options with a callback function? [closed]
- Post and Pages section inside WordPress admin are completely blank
- How to create a custom metabox like the wordpress provided tag metabox?
- Update Post meta with custom variable
- display all registered meta boxes
- Serving a custom featured image for mobile
- where can i see the registered new field for posts using register_meta() ?
- update_post_meta doesn’t work
- How to hide/show meta box using jQuery,if click on Drop-Down Menu
- wp_editor metabox does not output the saved html format
- Get value from meta box
- Adding Meta Box to Specific Submenu Page
- jQuery UI Sortable not Working With Metabox
- meta_box: update_post_meta for
- Ridiculous problem with CDATA [duplicate]
- Issue with file paths after porting metabox from main theme to child theme
- WordPress check if value equals and echo “checked”
- Selecting a dynamic sidebar via metabox in wordpress
- Custom-Metaboxes-and-Fields text_url field prepending http://
- Custom metabox for file upload return empty filename
- How to show metabox key to custom post?
- Video slideshow
- Issues with Saving Dynamic Metabox
- Meta Box Value not saving / populating?
- Related posts and custom meta_box?
- How to set default screen options?
- Meta Boxes causing Header errors
- why esc_url not working in smartmetabox
- Change Default Custom Fields Metabox Name on cctm plugin
- Form submit from modal window to parent window
- Calling Data from Custom Meta Box
- CPT posts in drop downed in meta box on page doesn’t return post ID
- Metaboxes – why they don’t render php in expected manner?
- How to make remove display none to this div container in post meta box?
- how making a selection from a taxonomy selector fixed definitively
- How can I put a checkbox in the post editor