Make WordPress Core


Ignore:
Timestamp:
07/11/2020 09:13:56 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Revisions: Restore the return value of wp_get_post_autosave() to the documented type of WP_Post for backward compatibility.

Follow-up to [48422].

See #34560.

File:
1 edited

Legend:

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

    r48422 r48438  
    222222 * Retrieve the autosaved data of the specified post.
    223223 *
    224  * Returns an object containing the information that was autosaved for the
    225  * specified post. If the optional $user_id is passed, returns the autosave for that user
    226  * otherwise returns the latest autosave.
     224 * Returns a post object with the information that was autosaved for the specified post.
     225 * If the optional $user_id is passed, returns the autosave for that user, otherwise
     226 * returns the latest autosave.
    227227 *
    228228 * @since 2.6.0
     
    238238    $user_id_query = ( 0 !== $user_id ) ? "AND post_author = $user_id" : null;
    239239
    240     // Construct the autosave query
     240    // Construct the autosave query.
    241241    $autosave_query = "
    242242        SELECT *
     
    261261    }
    262262
    263     return $autosave[0];
     263    return get_post( $autosave[0] );
    264264}
    265265
Note: See TracChangeset for help on using the changeset viewer.