Make WordPress Core


Ignore:
Timestamp:
02/22/2023 08:47:38 PM (2 years ago)
Author:
johnbillion
Message:

Revisions: Remove an unnecessary call to _doing_it_wrong() and corresponding new text string from the implementation of the new wp_save_post_revision_revisions_before_deletion filter.

While the guard condition was technically correct, it's not practical or necessary to provide this protection for every use of every filter, and it adds unnecessary burden to translators to provide translations for strings that will likely not be seen.

Follow up to [55254].

Fixes #57320

File:
1 edited

Legend:

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

    r55398 r55406  
    206206     * @since 6.2.0
    207207     *
    208      * @param WP_Post[]|int[] $revisions Array of revision objects or IDs,
    209      *                                   or an empty array if none.
    210      * @param int             $post_id   The ID of the post to save as a revision.
     208     * @param WP_Post[] $revisions Array of revisions, or an empty array if none.
     209     * @param int       $post_id   The ID of the post to save as a revision.
    211210     */
    212     $filtered_revisions = apply_filters(
     211    $revisions = apply_filters(
    213212        'wp_save_post_revision_revisions_before_deletion',
    214213        $revisions,
    215214        $post_id
    216215    );
    217 
    218     if ( is_array( $filtered_revisions ) ) {
    219         $revisions = $filtered_revisions;
    220     } else {
    221         _doing_it_wrong(
    222             __FUNCTION__,
    223             sprintf(
    224                 /* translators: %s: The filter name. */
    225                 __( 'The "%s" filter should return an array.' ),
    226                 'wp_save_post_revision_revisions_before_deletion'
    227             ),
    228             '6.2.0'
    229         );
    230     }
    231216
    232217    $delete = count( $revisions ) - $revisions_to_keep;
Note: See TracChangeset for help on using the changeset viewer.