It appears the post meta is not being cleared for ‘sunday’ when the checkbox is unchecked.
If( isset($_POST['sunday']) ){
update_post_meta($post->ID, "sunday", $_POST["sunday"] );
}else{
delete_post_meta($post->ID, "sunday");
}
return $post;
Or you can set the value to false
If( isset($_POST['sunday']) ){
update_post_meta($post->ID, "sunday", true );
}else{
update_post_meta($post->ID, "sunday", false );
}
return $post;
Related Posts:
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- Advanced search form with filters for custom taxonomies and custom fields
- Meta query with boolean true/false value
- How do I Paginate Search Results for Custom Post Types?
- How do I remove all the metaboxes for a custom post type?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
- Get all posts from custom post type and insert in select input as metabox
- Grossly inefficient wordpress loops!
- How Do I Use WP_Query to Run This Database Query as Search Result?
- WordPress Admin Panel search posts with custom post meta values along with title
- How to Update post status using meta data in Custom post TYpe
- Rest Api v2 orderby meta_key in custom post type
- bulk Update post_meta with default values
- Custom post type category not displaying in custom post type
- How to make custom post meta wp_editor translatable?
- How to add multiple featured image in meta box in post editor?
- update_post_meta() whenever custom post type is updated
- Add Post Url to Manage Edit Screen
- How to best delete orphan wp_postmeta
- Display all custom post type posts and order them by an optional meta_key
- How can I get_post_meta() in the most efficient way?
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Count posts with specific term_meta
- Custom search for custom post meta with pre_get_posts interferes with WP search
- WordPress Orderby Numeric Value Not Working
- Replace title column in post list with post meta value
- My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
- List all images from a single post meta value
- Ordering posts in Search & taxonomy by post_meta
- how to delete all users and posts based on ‘user_meta’?
- Meta Key Value in current-user-only loop
- How to set YouTube video as featured image?
- How to implement a Google map store locator
- Widget: Custom Post Type Post Listing Dropdown on Admin Side
- changing meta value and meta key of price field
- Posting to a Custom Post Type from front end – user generated content
- Update Post Meta for a logged in user
- How to duplicate entire custom post type
- Restrict Access to Posts based on Custom User and Post Meta Data
- get_post_meta returning no value in custom post type alert email
- WordPress request fiter order by related post’s post_title
- Getting thumbnails of a custom posts featured images in a page-templates metabox
- Custom fields for custom post type
- Show future events based on custom field AND order by date
- If Post Meta Equals Current Title Conditional Advanced Custom Fields
- create custom meta box with default value
- How to Echo Metadata Value in Currency Format
- Issue on Working with Metabox – Checkbox to enable Sale Items
- delete_post_meta() for whole CPT / multiple posts?
- How to move a post to different post type with all meta data?
- Why do I have to press the “Update” button twice to save my meta box values?
- how to show records that don’t have custom meta value
- WP API Response does not show my registered metadata
- How to detect that the save_post hook is calling the callback associated to the current edit post page only
- get_post_meta returns NULL in front-end, but correct result in back-end
- Problem with adding custom post type meta to header by plugin
- Meta box data is saved but NOT displayed in the meta box text field. Why?
- How to call a post’s metadata in shortcode.php?
- Echo custom post meta from options array
- Value of post meta dropdown is not showing in WordPress
- WP_Meta_Query object with conditionals
- Trying to write shortcode with get_post_meta but isn’t working
- HM CMB: Post Select Field for CPT ID
- updating one custom meta field only
- Add a class to post_class if more than one post shares same meta_value_num
- Function to return values from metabox
- Problem Saving Custom Post Type Meta Values
- Should I use a custom taxonomy or custom post type for grouping a list of panels associated with a group of tests?
- Add a form in every post and save data in post meta
- Show posts from WP Custom Post Type selected from a field in a metabox
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Peepso: Add extra data field (custom post meta) to postbox
- Change picture attachment meta of all occurrences of a picture
- Unknown Post Meta Records
- Get Previous Post based on Custom Field Name, for Custom Post Type
- Saving custom post types post_meta over REST-API fails
- add action save post type and update post meta woocommerce
- get_post_meta not working with variable as a post_id for dynamically get the postid
- Linking posts together with Advanced Custom Fields “both ways”
- Add more custom fields when creating a new custom post type
- Stripe multiple transactions
- How to get Current week and current date record wp query
- Edit is changing my custom’s post type parent id
- Disable Facebook Comments Automatically On CPT
- Problem with ‘save_post’ hook not running
- WordPress custom post type
- Edit post meta direct from post.php?
- Howto: use existing post_meta as options for a different metabox (checkboxes or list)
- Timetable of Custom Meta Data using Custom Post Type and Custom Taxonomy
- Change the contents of a dropdown through the admin panel?
- Top 30 Songs using Custom Post Type
- Advice Needed for Post Meta Database Efficiency
- fetch meta fields inside a widget
- Custom post type – update_meta not working
- Use a Variable in update_post_meta as the $meta_key
- Update an existing post in a custom post type
- Post Meta for Custom Post Types
- getEntityRecords/useEntityRecords: How to use CPT metadata?
- CPT meta values intermittently return empty