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
- what is the correct way to compare dates in a WP query_posts meta_query
- Get post with multiple meta keys and value
- Echo all meta keys of a custom-post TYPE
- Why won’t my metabox data save?
- Post metadata deletes itself
- Detect meta value changes when post is updated (post_updated)
- Is there an easy way to AJAX-ify saving of post?
- 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
- How can I include meta box content when searching?
- update a post meta from a single table cell TablePress
- Automatically adding meta data to posts or multiple query help
- Displaying custom posts only if custom meta box’s date is not expired
- Displaying Metabox value (custom post type taxonomy)
- get_post_meta is returning image id
- Custom Post Type, Saving Multiple Checkboxes
- Create a random unique 6 digit number as custom field for custom post type
- Export entries and multiple custom field meta to .csv?
- Metadata for a taxonomy – is there any WordPress way of doing this?
- Update CPT post meta with update_post_meta and cron job
- Insert post metadata for all posts in CPT at once if metadata no existent
- Display custom post type from dynamic custom field
- Populate dropdown from one custom post type inside another custom post type
- Get posts between custom dates
- How can I set taxonomy programmatically
- A better way to add a meta box to custom post types
- post meta parameter in post custom-post-type endpoint with restapi
- How do I set all of a particular post meta to a value within the custom post type I’m in?
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- Custom filter function not working with Custom post type
- Importing Data from a Non-WordPress database, into WP
- List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
- Can’t publish custom post type – “You are not allowed to edit this post.”
- Filter date from post meta when date is in string format
- Get only used meta_values
- Mutiple Select only POSTing 1 value
- Get $post->ID from a URL
- Displaying a div from an assigned meta_value when on a page
- Setting Post Title via Meta Data returns Auto-draft
- Filter posts by tax (dropdown) and meta value
- Values from meta-box not on $_POST
- Returning a custom content types with meta values
- Custom post type suddenly stoped working after WordPress 5 update
- How to show custom field on specific custom post type posts only when filled
- is_main_query() never called on WP 4.4
- How can I output WPAlchemy repeating fields meta values in my page template?
- Meta box data not saving
- Related posts meta_query CPT
- Meta box with front-end styling
- How can I get some of a posts meta data whilst it is still inserting?
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Cannot Save MetaBox Data in Custom Post Type
- Catch and display error on save_post action
- best way to use custom taxonomy, post type and meta in a job system
- Say I have a tech blog, how best would I store technical specs for a phone, if i use custom post types
- How to order custom posts by one of the custom fields value, ‘date’?
- Hide title field of selected post-types on edit pages
- WordPress CPT Taxonomy Dashboard Search – How to include taxonomy in search?
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- How to create review point system for CPTs (many-to-many relationship)
- After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
- How can I write a function that would update any missing specific post metadata?
- SELECT custom post type and its meta in SQL
- How to keep custom post type related information
- Custom attachment function not working in v5.4.2?
- Can’t save meta box data in WordPress using custom post types
- How to check for duplicate record before saving a Custom Post Type
- How can I use a custom template to load custom post type posts based on a post_meta value
- Save_post acf data not updating category of post type
- How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
- Custom Function to redirect singular post if specific meta field is empty
- Saving Child Terms on front end not setting parent
- Link two different post using there post_id in post meta
- Custom post type: “transition_post_status” action get title and other fields
- update a posts of other custom post type
- How do I extract the contents of a CPT’s custom field for all posts?
- Storing data in a multidimensional array from dynamically generated foreach loop
- Delete custom post type metadata without deleting the post in admin area
- Order by post meta value gets random results
- Metabox is not saving
- How can I get the $key / $value pairs of custom fields that were added via 3rd party plugins or themes?
- meta query always fails even if data is correct
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Display a post count from a custom metabox selection
- Rich Custom Field for Custom Post type not saving
- Custom post type submenu sorted by specific meta_key & meta_value
- Post AND page parameter for WP function
- How to display Author Profile based on Custom field value
- Automatically add custom taxonomy when meta value gets to a set number or beyond
- Display a list of posts whose meta field values are equal to the ID of the post being viewed?
- Check for custom field value in different post type than current one and do something
- Changing to different post type maintains the redirection?
- How do I add the “orange counter” next to a Custom Post Type?