Make WordPress Core

Changeset 58717


Ignore:
Timestamp:
07/15/2024 01:57:22 AM (3 months ago)
Author:
SergeyBiryukov
Message:

Docs: Correct documentation for _wp_preview_meta_filter().

The $single parameter is passed via the get_post_metadata filter and has no default value.

Includes minor code layout fixes for consistency with the formatting of other long conditionals in core.

Follow-up to [56714].

Props rodrigosprimo.
Fixes #61645.

File:
1 edited

Legend:

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

    r58105 r58717  
    11081108 * @param int    $object_id Object ID.
    11091109 * @param string $meta_key  Meta key to filter a value for.
    1110  * @param bool   $single    Whether to return a single value. Default false.
     1110 * @param bool   $single    Whether to return a single value.
    11111111 * @return mixed Original meta value if the meta key isn't revisioned, the object doesn't exist,
    11121112 *               the post type is a revision or the post ID doesn't match the object ID.
     
    11141114 */
    11151115function _wp_preview_meta_filter( $value, $object_id, $meta_key, $single ) {
    1116 
    11171116    $post = get_post();
    1118     if (
    1119         empty( $post ) ||
    1120         $post->ID !== $object_id ||
    1121         ! in_array( $meta_key, wp_post_revision_meta_keys( $post->post_type ), true ) ||
    1122         'revision' === $post->post_type
     1117
     1118    if ( empty( $post )
     1119        || $post->ID !== $object_id
     1120        || ! in_array( $meta_key, wp_post_revision_meta_keys( $post->post_type ), true )
     1121        || 'revision' === $post->post_type
    11231122    ) {
    11241123        return $value;
     
    11261125
    11271126    $preview = wp_get_post_autosave( $post->ID );
     1127
    11281128    if ( false === $preview ) {
    11291129        return $value;
Note: See TracChangeset for help on using the changeset viewer.