From ffc55e249f85afce7642c98013d9b8312a1fe4c6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 22 Feb 2023 20:49:20 +0000 Subject: [PATCH] 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 Built from https://develop.svn.wordpress.org/trunk@55406 git-svn-id: http://core.svn.wordpress.org/trunk@54939 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/revision.php | 21 +++------------------ wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/wp-includes/revision.php b/wp-includes/revision.php index 783bd06e15..b4ecf0c863 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -205,30 +205,15 @@ function wp_save_post_revision( $post_id ) { * * @since 6.2.0 * - * @param WP_Post[]|int[] $revisions Array of revision objects or IDs, - * or an empty array if none. - * @param int $post_id The ID of the post to save as a revision. + * @param WP_Post[] $revisions Array of revisions, or an empty array if none. + * @param int $post_id The ID of the post to save as a revision. */ - $filtered_revisions = apply_filters( + $revisions = apply_filters( 'wp_save_post_revision_revisions_before_deletion', $revisions, $post_id ); - if ( is_array( $filtered_revisions ) ) { - $revisions = $filtered_revisions; - } else { - _doing_it_wrong( - __FUNCTION__, - sprintf( - /* translators: %s: The filter name. */ - __( 'The "%s" filter should return an array.' ), - 'wp_save_post_revision_revisions_before_deletion' - ), - '6.2.0' - ); - } - $delete = count( $revisions ) - $revisions_to_keep; if ( $delete < 1 ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index e8534764c8..85875cc15f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-beta3-55405'; +$wp_version = '6.2-beta3-55406'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.