Make WordPress Core


Ignore:
Timestamp:
02/24/2016 12:43:31 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Revisions: Clean up _wp_post_revision_fields():

  • Move the array processing to a new function, _wp_post_revision_data().
  • Make both functions accept a post array or a WP_Post object.
  • Always apply the _wp_post_revision_fields filter and pass the post data to it.

Fixes #13382.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r36584 r36659  
    16631663    // Store one autosave per author. If there is already an autosave, overwrite it.
    16641664    if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) {
    1665         $new_autosave = _wp_post_revision_fields( $post_data, true );
     1665        $new_autosave = _wp_post_revision_data( $post_data, true );
    16661666        $new_autosave['ID'] = $old_autosave->ID;
    16671667        $new_autosave['post_author'] = $post_author;
     
    16701670        $post = get_post( $post_id );
    16711671        $autosave_is_different = false;
    1672         foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields() ) ) as $field ) {
     1672        foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
    16731673            if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
    16741674                $autosave_is_different = true;
Note: See TracChangeset for help on using the changeset viewer.