Articles of autosave

Assign category a default post type

This one has been bothering me for a few days now, so I’d really appreciate any help you can give me. Problem overview: I have a plugin which automatically creates a post and assigns the category “YouTube” whenever a new video is uploaded to a YouTube channel. This part works fine. However – I’m also […]

Disable auto-save and post revisions from inside a theme or plugin

Per default, the way to disable autosaving and post revisions, is to modify wp-config.php. Is there a way, to do that from within a plugin or a themes functions.php?

Autosave interval remains default despite wp-config.php defines

On site which I maintain there are writers that spend a lot of time editing single posts, and autosave every minute is very painful for them. So they asked me to set it to at least 10 minutes. I found an official way to change autosave interval, so I’ve put this line in wp-config (at […]

How to: Avoid a bunch of useless Auto Draft ID entries related in posts table and disable autosave feature in 'post-new.php'?

I got it! Buuuuut I had to edit 2 core files, yes! 2 core files 🙁 I know is not a cool plugin hack, but maybe a cool patch for WP, Im using 3.3.1 version. Well, here is my little hack/contribution: wp-admin/post-new.php 1 Comment: //wp_enqueue_script(‘autosave’); 2 Change: $post = get_default_post_to_edit( $post_type, true ); $post_ID = […]

Trigger save as draft when uploaded image

I have a custom post type with two custom meta boxes. The first meta box is a gallery that allows me to upload some images. The second meta box is a drop-down with some options. I selected an option from second meta box. Then, inside the first meta box, I have a button to open […]

Custom post meta values reset by autosave

This question already has an answer here: post meta data clearing on autosave 2 answers

Popup or admin/update notice on post/page edit screen without page refresh

WordPress has similar functionality when another user is “taking over” editing a post WP gives you an instant warning. I want to be able to either trigger a popup or show a new admin notice on top of the edit screen based on an option change. The main thing is that this has to be […]

Make metabox of custom post type fully autosave- and bulk-/quick-edit compatible

I’m trying to create a custom post type and I’ve had the same problem that’s described here; my custom meta information was properly saved, when saving manually, but got lost as soon as the autosave ajax ran at least once. So I now use the shown solution to fix this: function save_stationinfo($post_id) { if((defined(‘DOING_AUTOSAVE’) && […]

Custom post preview without saving

I’ve added JS to my responsive theme which changes the preview button on the post edit page into a link to an offsite page. The page contains a 320px x 568px iframe which shows the post in the mobile layout, much like this site. I pass the post’s URL as an argument in the link’s […]

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 […]