Articles of autosave

Adding a cancel button to edit post screen

I’m actually quite surprised WP hasn’t already implemented this. I want to add a Cancel button to the edit post screen which will do some cleanup when pressed. After a little playing while watching my tables, here’s some things I’ve noticed. A new post is created with a post_status of auto-draft. This is changed to […]

Trigger Autosave or disable unsaved changes dialog

As the title says, I want to trigger the autosave function of wordpress manually or just disable the “unsaved changes” dialog. The reason for this: I’m developing a plugin which reloads the post edit page after doing some stuff and it’s just annoying that the “unsaved changes” popup always pops up before reloading.

How WordPress autosave can save plugin fields?

Setup: WordPress Add/Edit Post/Page A plugin that have its own postbox with several hidden fields. Issue: How these custom hidden fields can be saved along with the other post data within the Autosave feature? Thanks

Callback for wp.autosave.server.triggerSave();

I’m using following code to force WordPress page to save post as draft, is there any callback function for it, I want to alert a text after it complete saving post as draft. if ( wp.autosave.server ) { wp.autosave.server.triggerSave(); }

CPU usage: AJAX and Heartbeat API on admin pages

My (shared) web host recently sent me this: “Our server monitoring systems keep indicating high server load persistently maintained by your website (…). Most of the hits are to the /www/www/wp-admin/admin-ajax.php script. We would advise the following: Do not stay logged into the WordPress dashboard through the day. Once you finish your work, you should […]

Enabling autosave when plugin disabled

I found that Woocommerce is disabling autosave, maybe for good reason, but I’d like to have it turned on and see if it presents an issue. This is what I found in the __construct in their post type class, from wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php…. // Disable Auto Save add_action( ‘admin_print_scripts’, array( $this, ‘disable_autosave’ ) ); Then further down […]

Is it wise to delete post revisions and autosaves from database?

I’m just wondering is it wise to delete all post revisions and autosaves from database every once in a while? I mean they take a lot of database space and apparently have no use after the post has been published.

Autosave control in WordPress

I’ve been trying to find a filter or settings in WordPress to control the Autosave behavior, preferably by post type. When querying the database, I see our auto-drafts only go back one week, is there something in WordPress that controls this behavior? I’d like to be able to have auto-draft kept 90 days or more […]

How to properly turn off REVISIONS and AUTOSAVE for whole site and optionally for a custom post type only

Is there a hook/function combination that can be added to my theme’s functions.php to properly disable REVISIONS and AUTOSAVE for the entire wordpress installation? What about if just for a certain custom post type? Searching online gives various hacks from deregistering scripts to tampering with core files. What’s the acceptable/correct way to do this?