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
- Add a Meta Box for uploading a SECOND Featured Image?
- Remove the Yoast SEO Post Metabox [closed]
- Sample code for validating custom metabox?
- How to force one column layout on custom post type edit page?
- Check for and enforce unique value in user-entered custom meta field in WP Admin
- How to add a class to meta box
- Add Meta box Befoure Post Title
- Editing Screen: Make Update or Publish Button Follow The Page
- Why can’t I hook into save_posts after admin_init?
- Meta Boxes in Front End Post Submission Form
- Custom meta box shown when template is chosen [duplicate]
- Modifying the main editor priority
- How to make a meta box field a requirement
- Adding uploaded images to editor from metabox instead of default popup uploader
- Choosing a default page tempate (Classic => Gutenberg)
- How to remove the RichText Meta Box
- Add character count to custom metabox
- Update caption for metabox gallery images
- datetime_timestamp shows numbers only? need in date and time
- Custom Metabox with Ajax in Edit Post – Stuck
- Post.php – Conditional statements for new post and edit post
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- How to generate a featured image from a video embeded in a metabox
- Meta box io oembed returns list not array
- How to verify meta box is registered in Unit Testing?
- Add a custom field to top attribute in WooCommerce
- wp_editor in metabox not working
- Select box saves but doesn’t update value in admin
- retrieve meta key when checkbox is used
- Add Meta Box not showing on New Post – Custom meta box not showing
- Customize WordPress Media Upload and New Media Manager Menu in add post Metabox
- How to display a custom post type’s media library inline on meta box
- Modules with meta box implementations
- Remove meta box for specific page
- How To Add Custom Meta PDF Upload Box to WooCommerce Products (and post link on frontend)
- Using WYSIWYG In custom meta boxes
- Visual/Text tabs in wp editor Not Showing
- save_post action to include wp_insert_post_data filter, gathering meta field info & prevent infinite loop
- Change the context of excerpt metabox for the ‘New Post’ page
- How to have meta boxes save via REST in Gutenberg?
- Show preview of post changes on page
- Add Metabox to settings / options page
- Undefined index error in custom post metabox
- WPAlchemy MediaAccess inserting media link in WP Editor instead of custom field in metabox [closed]
- Meta Box will not display
- I need a “Choose from existing content” popin
- How can i use this meta box function in my template ? (WordPress)
- How to disable Author dropdown in Gutenberg’s Status and Visibility panel
- Why does not my metabox save?
- How can I hide custom field from users used for caching response from external api?
- Display stored value in Meta Box
- Display Content if custom meta box checkbox is checked
- How to add meta box for current post format?
- How to check specific value in two metabox?
- How to show taxonomy terms from wordpress database?
- Error showing in current page id in wordpress admin
- Show value of select dropdown in meta box
- Output list from each line of metabox (shortcode)
- Hybrid meta box, how to show?
- Understanding WordPress’ post type support
- Include doesn’t work, getting strange path: (/usr/local/php53/lib/php) – Whats wrong? (WPAlchemy)
- wordpress alchemy put custom metabox on certain page only
- using WPalchemy to output custom metabox from homepage template
- Make separate text boxes for separate WordPress Custom Fields
- Custom meta box data in rss feed
- Placing Admin Post Metaboxes in Tabs
- How using the Meta Box plugin, to filter posts by the value of a post type field?
- Metabox types list
- Some custom post types did not return an object
- metabox dosn’t save with checkbox of post_type values order by taxonomy
- Is there default meta boxes types that handles types and sanitization?
- how to update editor content from metabox
- Resposive admin classes?
- Only allow one meta key value per post in a category
- Make metabox always be on top (sticky)
- Generating image sizes when uploading through wp.media
- When post is updated, custom metadata in text area field is overwritten
- Set post title to same value as a tow meta box
- Support Multiple featured images
- add_post_meta Adds post meta but the value is blank
- Best practices for meta box placement?
- Echo order box (in pages)
- Problems with a custom meta_box
- Tags meta box don’t show when creating a new post type
- Remove “minor-publishing” div from Publish admin metabox
- Remove Title, Editor and Meta Box Support Based on Post Formats
- Custom select box meta field
- Metaboxes – why they don’t render php in expected manner?