The code indeed only looks at the TinyMCE editor or the title and content field if the editor is hidden:
window.onbeforeunload = function(){
var mce = typeof(tinyMCE) != 'undefined' ? tinyMCE.activeEditor : false, title, content;
if ( mce && !mce.isHidden() ) {
if ( mce.isDirty() )
return autosaveL10n.saveAlert;
} else {
title = $('#post #title').val(), content = $('#post #content').val();
if ( ( title || content ) && title + content != autosaveLast )
return autosaveL10n.saveAlert;
}
};
You could replace that onbeforeunload
handler with your own (be sure to include the existing functionality of course). Or play with the isDirty()
state of the TinyMCE editor and that autosaveLast
value?
Related Posts:
- update_post_meta() whenever custom post type is updated
- How to detect that the save_post hook is calling the callback associated to the current edit post page only
- Custom post type meta fields missing on save_post_type
- How to save post_status using action save_post?
- Custom meta box data not saving
- Problem with ‘save_post’ hook not running
- Query all posts where a meta key does not exist
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- what is the correct way to compare dates in a WP query_posts meta_query
- Advanced search form with filters for custom taxonomies and custom fields
- Using save_post to replace the post’s title
- Prevent post from being published if custom fields not filled
- Meta query with boolean true/false value
- Get post with multiple meta keys and value
- Correctly delete posts with meta and attachments [duplicate]
- Storing revisions of metadata for custom post type
- Custom field values deleted when trashing custom post type
- How to get all custom fields of any post type
- Update CPT meta data using REST API
- Admin Area Custom Type Search By Meta Fields Without Title & Content
- Echo all meta keys of a custom-post TYPE
- Custom Post type – how to get checkbox to update meta field to null
- How can I filter posts by post_parent in the admin?
- Why won’t my metabox data save?
- How do I Paginate Search Results for Custom Post Types?
- Custom post type save_post action not firing
- Submitting posts from the front end – sanitizing data
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- Ordering posts having multiple post-meta date fields
- Custom Post Type with Input fields to seperate table on database.
- How do I remove all the metaboxes for a custom post type?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Gutenberg how to make attribute to save to meta
- How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
- Post metadata deletes itself
- How to create a mini directory in WordPress?
- How Can I save multiple records in same meta key?
- Get all posts from custom post type and insert in select input as metabox
- Detect meta value changes when post is updated (post_updated)
- Search everything (posts, pages, tags, cpt, meta)
- Is there an easy way to AJAX-ify saving of post?
- Permalinks using event date (year & month) instead of publication date
- Custom Post Type: Set post_title equal to a custom post type field
- I can’t set meta_key in my custom post type query
- Grossly inefficient wordpress loops!
- Custom field values get deleted
- Compare 3 custom fields and sort by oldest
- 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
- Creating a custom post type upon registration
- How to Update post status using meta data in Custom post TYpe
- Change 2 fields in the post depending on the 3rd field before save
- Rest Api v2 orderby meta_key in custom post type
- bulk Update post_meta with default values
- Reason action hook won’t work with update_post_meta from frontend form? Alternative?
- Can’t sort order of wp_query with 2 meta keys
- Showing Meta Data for Custom Post Types?
- How to get source of custom meta image?
- Having trouble with custom post type / meta box
- Query for posts from any post type but only add instock products
- How can I include meta box content when searching?
- update a post meta from a single table cell TablePress
- update custom post type meta from a shortcode
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Displaying Meta Box Image
- Custom post type category not displaying in custom post type
- Unable to save or update postmeta for custom post type via action using save_post hook
- How to make custom post meta wp_editor translatable?
- Automatically adding meta data to posts or multiple query help
- How to keep a check box in custom meta box for custom post type checked by default for add new post?
- How to add multiple featured image in meta box in post editor?
- Show metabox in custom-post-template depending on taxonomy term?
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Using date stored as custom field to filter posts displayed in admin
- Conditionally Query Custom Post Types by Post Meta for Blog Home Page?
- Displaying custom posts only if custom meta box’s date is not expired
- Displaying Metabox value (custom post type taxonomy)
- Frontend posting – everything saves other than checkboxes?
- How do I sort a custom post type admin column using two meta keys?
- Add Post Url to Manage Edit Screen
- How to best delete orphan wp_postmeta
- How can I display my custom metaboxes on a custom post template?
- Custom Post Custom Taxonomy Data Not Saving in Edit Screen
- Display all custom post type posts and order them by an optional meta_key
- Meta Box Only in CPT Edit Page, Not in Add New
- get_post_meta is returning image id
- Custom Post Type, Saving Multiple Checkboxes
- get_template_part() – post-meta not working?
- Is it possible to create a post using a metabox?
- 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
- Create a random unique 6 digit number as custom field for custom post type
- Export entries and multiple custom field meta to .csv?
- how to interconnect custom post types?
- WordPress Orderby Numeric Value Not Working
- Custom Post Status Transition Issues With Get Post Meta
- Replace title column in post list with post meta value