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:
- How do test if a post is a custom post type?
- Remove Custom Taxonomy Metabox from Custom Post Type Screen
- Do I need a nonce field for every meta box I add to my custom post type admin?
- How to change default position of WP meta boxes?
- Help Creating a Slideshow Custom Post Type with Custom Meta Boxes?
- Custom Taxonomy as checkbox or dropdown
- Conditional for single-{post-type}.php
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- Multiple Custom Metabox Help
- How to force one column layout on custom post type edit page?
- Can you make a custom metabox field be required to save a new post?
- Why won’t my metabox data save?
- Custom Post Type – Taxonomy Dropdown Menu?
- Action hook on Edit custom post type?
- wp_dropdown_categories in custom post type with custom taxonomy
- Display content from custom meta boxes in revisions
- How can I add a column/s to wp_posts table?
- How to add meta box to backend menu page
- How to add multiple images to a custom post type single post?
- echo value from ‘select’ field type into page template using cmb2?
- How to add multiple images to custom post type?
- Listing Pages With Checkboxes In a Metabox (and saving them)
- Changing the priority of a custom taxonomy’s metabox
- How do I remove all the metaboxes for a custom post type?
- WP_List_Table Inside Metabox Not Working on Submit
- How To Set Custom Post Type Title Without Supports
- Custom post type metabox array
- Add metabox with media uploader in a custom post type [duplicate]
- is_singular() not working if called via callback function of admin-ajax.php
- Creating a Custom Post Types dropdown in a Meta Box
- Remove tabs from media uploader for a CPT
- Find callback function for custom taxonomy metabox
- Remove custom metaboxes from custom post type
- wp_generate_attachment_metadata gives me an empty array
- How to get custom metabox image field?
- Get all posts from custom post type and insert in select input as metabox
- functions.php conditional tag only for custom post type
- Detect meta value changes when post is updated (post_updated)
- Best way to arrange custom post types by Attributes -> Order metabox value?
- Add pre-existing meta box to new custom post type
- Exclude custom function content from certain pages
- Dynamic page.php template for custom post types
- Get template part based on custom taxonomy term
- Add special meta box to custom post type
- Add comments meta fields to comments metabox on post edit screen
- Removing Edit Permalink/View “Custom Post Type” areas
- Unable to save custom taxonomy terms in a custom-built metabox
- Custom field values get deleted
- Custom field being erased after autosave
- Order custom posts by a date metabox
- How to select one major category (or custom taxonomy) for a custom post type?
- How to sort CPT by custom meta value (date), and return posts month by month
- Priority of Meta Box for Custom Post Type
- If on term-page -> get the current term?
- How can i add a metabox to pull list of custom posts (any two) on edit or add post screen?
- WordPress metabox file upload in custom post [duplicate]
- How to add a select menu to this metabox code?
- Use Custom Post Type as Custom Field
- Saving multiple Metabox contents
- Custom post type in submenu with custom meta box as a title with custom html
- Problems with a custom meta_box
- Add Metabox to all custom post types
- Adapting plugin for custom post type?
- Customized featured image doesn’t refresh in post admin metabox after upload/insert
- Custom Post Query Combined with Conditional Tags
- Loading one meta box only on post-new.php with a forward link
- Custom post type – permalink
- Textarea type on one field custom add_meta_box?
- Saving custom metabox data with a twist
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- loop through custom post-type with two meta_keys
- Extending a CPT by Created by another plugin
- How to query custom post then display sections by meta value
- Custom meta box includes
- Creating entries with image attachements within posts and managing them in a list
- Post AND page parameter for WP function
- Add text to metabox input text field from Thickbox
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- CPT Metabox with email notification
- Adding a custom “Add Custom Field” button to Custom Meta boxes
- add a “list” into add meta box : problem
- Move title “meta box” in post mode
- Conditional statement checking two conditions for CPT and Custom Taxonomy [closed]
- CPT Template Option to Top
- strange conditional tag behaviour [duplicate]
- Show search for data extracted from metabox
- Use a Variable in update_post_meta as the $meta_key
- Display div based on Group metabox selection [closed]
- Issues on saving data from CPT select metabox
- Canot save post if any meta box was empty
- Remove custom meta boxes from custom post type
- Multiple posts selection [closed]
- Custom post type is_singular condtional not working when managing sidebar display
- Cannot change meta box position
- Just the First Metabox what saves the data!
- How to consume external API from WordPress post editor and display the response data in the custom field?
- My custom meta box with textarea field not saved
- custom post type with metabox custom fields
- How to show metabox in custom php menu page
- Can’t retrieve custom post type taxonomy term to custom post type editor