SOLVED!!
There was a separate check for CPT needed for the saving to work. So the conditional code now stands at:
function set_options() {
parent::set_options();
global $pagenow;
if ( isset( $_GET['post_type'] )
&& $_GET['post_type'] == 'session'
&& 'post-new.php' == $pagenow || isset( $_GET['post'] )
&& 'session' == get_post_type( $_GET['post'] )
&& 'post.php' == $pagenow || isset( $_POST['post_ID'] )
&& 'session' == get_post_type( $_POST['post_ID'] )
) {
// do your metabox options thing - same code as above
}}
And now everything works as it should. It was the $_POST['post_ID']
that was needed.
Related Posts:
- Remove Custom Taxonomy Metabox from Custom Post Type Screen
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- Can you make a custom metabox field be required to save a new post?
- Display content from custom meta boxes in revisions
- Changing the priority of a custom taxonomy’s metabox
- is_singular() not working if called via callback function of admin-ajax.php
- How to get custom metabox image field?
- Detect meta value changes when post is updated (post_updated)
- Exclude custom function content from certain pages
- Custom field being erased after autosave
- How to select one major category (or custom taxonomy) for a custom post type?
- How can i add a metabox to pull list of custom posts (any two) on edit or add post screen?
- Cleanest way to code “Custom Write Panels/Meta Boxes”?
- Custom post type’s slug gets wrong when adding a custom meta box
- update custom post type meta from a shortcode
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Calculate Repeater Meta Box Input Field Values and Display Total
- How to add meta boxes(repeater fields) from WordPress back end?
- Displaying Meta Box Image
- Multiple information using custom post type
- get_terms won’t display product_cat or any other custom taxonomies when specified
- 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
- get_post_meta is returning image id
- Why do I lose the content of meta boxes when I leave the page?
- WordPress nl2br is not converting newline to html line break when saving metabox value
- List custom post types in metabox
- Create custom PAGE with register_post_type
- Duplicate Custom Header Functionality into the post edit screen
- Send email button in custom post type backend
- Custom meta box data array: foreach not working correctly?
- What’s the difference between same wp functions get_posts(); functions in different form?
- Troubles with saving metabox
- How to check if user meta field is empty in conditional else statement
- Custom Post Type with Templates using Meta Boxes?
- Post Quote with image on header for news site
- A better way to add a meta box to custom post types
- Plugin – Combine Meta Box Input Fields into single saveble record
- Create Connection Between two post types
- Cannot save CPT meta box
- Create a Dropdown from Custom Post Type
- meta box on custom post type
- Listing custom terms in custom post meta
- Can’t publish custom post type – “You are not allowed to edit this post.”
- Moving meta boxes in admin
- Can I restrict category availability?
- Displaying a div from an assigned meta_value when on a page
- Using custom post type as taxonomy
- Create a custom post type for a photo post
- Showing taxonomy terms on custom post type
- Metabox multiple custom post select -> display selected items?
- Custom post type suddenly stoped working after WordPress 5 update
- Display metaboxes if checkbox ir marked
- Check if custom post is a parent?
- Filter posts of custom post type by meta key in (List All Section)
- Create a select metabox that the user can pupolate?
- Display custom meta on page that has been check in custom post type
- saving dropdown menu data on custom post type
- Set Default Option Value as Blank for Meta Box
- Related posts meta_query CPT
- Meta box with front-end styling
- Sanitaizing Select Optin For Custom Post Type Metabox in WP
- Cannot Save MetaBox Data in Custom Post Type
- Custom post type meta box empty after save
- How to add a class to meta boxes (to customize them in CSS)?
- If tag exists, then echo once
- Problem On Retrieving Post Meta Data on Custom Column [closed]
- Saving metabox keys and storing values as array
- Custom MetaBox : Food Menu Item Available Dates
- how to compare different timestamps in wp-query for events custom post types?
- Create post meta box that links another post
- How to avoid duplicate posts queried from custom meta?
- WP_List_Table Inside Metabox Not Working on Clicking Search Button
- How can I check the rewrite slug of current post type listing page
- How to add custom PHP code in post header?
- Simple Data picker meta box
- How save custom meta type posts multicheck grouped by taxonomy (with CMB2) [closed]
- Metabox messes up permalink
- Custom meta box data not saving
- Collect custom post in a calendar
- Render the metabox input values as HTML
- conditional based upon the count of current user’s published custom posts
- How to check if meta box value is false for all posts then do something based on that
- Problem with ‘save_post’ hook not running
- Custom meta-box for all custom post types
- Meta-Box to add multiple items one at a time and on publish save all
- WPAlchemy Metabox rewriting slug
- Displaying wp post categories into my custom metabox
- Filter CPT based on meta box value using Flexible Posts widget?
- Add Metabox to all custom post types
- Loading one meta box only on post-new.php with a forward link
- Textarea type on one field custom add_meta_box?
- Creating entries with image attachements within posts and managing them in a list
- Adding a custom “Add Custom Field” button to Custom Meta boxes
- add a “list” into add meta box : problem
- Show search for data extracted from metabox
- Issues on saving data from CPT select metabox
- Remove custom meta boxes from custom post type