You method iam_user_can_save
is incorrectly used as you are returning nothing to check in that method. Try this (not sure what behaviour you really want, the following code is just a working example from your code):
public function iam_user_can_save( $post_id, $nonce ){
// Checks save status
$is_autosave = wp_is_post_autosave( $post_id );
$is_revision = wp_is_post_revision( $post_id );
$is_valid_nonce = ( isset( $_POST[ $nonce ] ) && wp_verify_nonce( $_POST[ $nonce ], 'iam_nonce_check' ) ) ? 'true' : 'false';
if ( $is_autosave || $is_revision || !$is_valid_nonce ) {
return false;
}
return true;
}
Related Posts:
- WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins
- How To Remove The “+ Add New Category” Link From A Category Metabox
- Removing Metabox for “Slug” without removing functionality
- Problem with meta box in Links
- How to modify Publish metabox?
- Set default value for radio button in WP Alchemy custom meta box?
- My custom write panels won’t save data. What am I missing?
- Cannot remove meta box added through OOP
- remove a single post_meta
- save meta data of custom post type: WP_Error has no effect, even if insufficient capabilities
- Select Options Meta Data is Not Updating in Edit Meta Box
- Saving an upload media meta box field
- Create more Meta Boxes as needed
- Should all plugins be encapsulated in a Class?
- Set Default Admin Screen options & Metabox Order
- How to set default screen options?
- Passing error/warning messages from a meta box to “admin_notices”
- Add “upload media” button in meta box field
- Add a Meta Box for uploading a SECOND Featured Image?
- Plugin Form Submission Best Practice
- Does WordPress have a “Form API”?
- Metabox with checkbox is not updating
- How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button
- What is the “Advanced” $context in add_meta_box?
- Using classes instead of global functions in functions.php
- Removing panels (meta boxes) in the Block Editor
- Change The Title Of a Meta Box
- How to make open/closed and hidden/shown metaboxes status saved on a per-post basis?
- How can I create a taxonomy meta-box with search suggestions but no new terms input?
- Remove the Featured Image Meta Box
- Remove the Yoast SEO Post Metabox [closed]
- Make Custom Metaboxes Collapse by Default
- Best practices for meta box placement?
- Creating a metabox to upload multiple images
- How Does WordPress Remember Metabox Positions?
- Sample code for validating custom metabox?
- Post custom metabox textarea using wp_editor
- How to force one column layout on custom post type edit page?
- How to Add Reminders/Notes to New Post Meta Boxes
- How do I get attachment_id?
- How to reorder meta box position?
- Prevent sorting and dragging of specific postbox metabox
- Check for and enforce unique value in user-entered custom meta field in WP Admin
- One metabox for multiple post types
- How do I position meta_box on post edit screen after the title?
- How to add a class to meta box
- Has anyone successfully integrated qtranslate with custom metaboxes?
- Put the media uploader in a metabox
- Custom Meta Boxes: multiple fields within a repeatable field
- Is it possible to change the attributes of a registered style or script before it fires?
- Removing meta boxes: remove-meta_box() or unset()?
- Save checkbox value in metabox
- How to group meta boxes on the post edit page
- Use meta box drag and drop to order items independently
- Adding another state (spam, reject, approve) to wordpress comments?
- inside a metabox
- Add Meta box Befoure Post Title
- Hiding a theme’s meta box
- How do I extend one plugin I’m writing with another I’m writing using classes?
- Metabox date month number to word
- get registered metaboxes by post type or post ID
- Remove metabox from specific page template in admin
- Is there a filter/action to add content to WP admin metaboxes?
- Attach Files Metabox
- CMB2 metabox conditional logic
- Tinymce/WordPress is removing all line-breaks?
- How do I create a meta box for dates?
- Adding submit or update button to custom metabox?
- Editing the Default Links like “Site Admin” in the Sidebar Meta Section?
- How to pass variable via $callback_args for add_meta_box
- Undefined function error when creating Custom Meta Box
- How to get meta box data to display on a page
- esc before saving or before displaying does it matter?
- Block metabox – No expanding, no moving around
- Move excerpt to always be directly below post content in admin
- Access the environment of an admin page from another admin page
- Add a meta description to home page?
- Editing Screen: Make Update or Publish Button Follow The Page
- Removing custom meta box added in parent theme
- Add filter ‘wpautop’ to meta box textarea
- Use meta box value in CPT as post title
- Custom “Publish” / “Update” button &
- Why can’t I hook into save_posts after admin_init?
- Meta Boxes in Front End Post Submission Form
- Getting the ID of a meta box
- how to sanitize checkbox input?
- add_meta_box does not go ‘side’
- Custom filter for the_content doesn’t work correctly
- Remove a plugin meta box from the dashboard
- How to insert Gallery shortcode to a meta box
- Getting jQuery sortable items in custom metabox
- Custom meta box shown when template is chosen [duplicate]
- Modifying the main editor priority
- How to make a meta box field a requirement
- Check if meta key value already exists
- Add comments meta fields to comments metabox on post edit screen
- How to make multicheck for post/page meta box
- Display list of tags as drop down menu or radio buttons in a meta box?
- Adding uploaded images to editor from metabox instead of default popup uploader
- How do I stop HTML entities in a custom meta box from being un-htmlentitied?