Make WordPress Core

Ticket #44786: autosave-allow-revision.diff

File autosave-allow-revision.diff, 834 bytes (added by jblz, 5 years ago)
  • src/wp-includes/revision.php

     
    109109 * @return int|WP_Error|void Void or 0 if error, new revision ID, if success.
    110110 */
    111111function wp_save_post_revision( $post_id ) {
    112         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
     112        $autosave = defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE;
     113        /**
     114         * Filters whether saving of revisions is allowed during autosaves.
     115         * Normally, it is disallowed whenever the `DOING_AUTOSAVE` constant is truthy.
     116         *
     117         * @since 5.0.0
     118         *
     119         * @param bool    $allow Is saving of revisions allowed for autosaves.
     120         */
     121        if ( $autosave && ! apply_filters( 'allow_revisions_for_autosave', false ) ) {
    113122                return;
    114123        }
    115124