Disable autosaves and revisions

This topic contains 3 replies, has 2 voices, and was last updated by  Alfonso Sánchez Gómez 4 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #533441

    Alfonso Sánchez Gómez
    Expired Member
    Post count: 67

    Good morning, when I am editing a listing and instead of saving I leave the page, or I hit F5, the message of “Hey, we found some unsaved changes from earlier and are showing them below….” always appears (in Spanish it is obviously another).

    I would like to disable this because sometimes it has given problems with package changes. I also prefer not to confuse users. I have read in other posts and put in my wp_config.php the following code:
    define(‘AUTOSAVE_INTERVAL’, 86400);
    define( ‘WP_POST_REVISIONS’, false );

    But it still doesn’t work.

    You can try editing a listing and immediately hit F5.

    #533442

    Alfonso Sánchez Gómez
    Expired Member
    Post count: 67
    This reply has been marked as private.
    #533514

    Alex Rollin
    Moderator
    Post count: 27815

    I will ask the developers to check on your idea.

    Thanks for your patience while they look into it.

    #535112

    Alfonso Sánchez Gómez
    Expired Member
    Post count: 67

    I found a solution, I added this code in my functions.php

    add_action( 'init', 'deleteRevisions' );
    function deleteRevisions() {
    	// Get current post revisions
    	$post_revisions = wp_get_post_revisions( $_GET["pid"] , array(
    				'check_enabled' => false
    			) );
    	// Delete them
    	foreach ($post_revisions as $post_revision)		
    		wp_delete_post($post_revision->ID);
    }

    Now if I refresh page the message doesn´t show.

    Regards.

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket