Media: Consistently call the `wp_create_file_in_uploads` hook as a filter.

The filter was initially introduced for file replication purposes. Since the returned value is not always used directly, some instances were later converted to an action as part of removing unused variables, and the hook was documented as an action while still being called as a filter in other instances.

This commit aims to correct the discrepancy between the code and the documentation.

Follow-up to [4673], [4817], [4818], [6363], [6551], [13041], [25821], [33154], [33280].

Props Howdy_McGee, nicolefurlan, johnbillion, mhshujon, SergeyBiryukov.
Fixes #57775.
Built from https://develop.svn.wordpress.org/trunk@56929


git-svn-id: http://core.svn.wordpress.org/trunk@56440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-10-13 12:20:20 +00:00
parent 7fb21f4110
commit 163f5e566f
3 changed files with 8 additions and 5 deletions

View File

@ -571,8 +571,9 @@ class Custom_Background {
$thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
set_theme_mod( 'background_image_thumb', sanitize_url( $thumbnail[0] ) );
/** This action is documented in wp-admin/includes/class-custom-image-header.php */
do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication.
/** This filter is documented in wp-admin/includes/class-custom-image-header.php */
$file = apply_filters( 'wp_create_file_in_uploads', $file, $id ); // For replication.
$this->updated = true;
}

View File

@ -882,14 +882,16 @@ endif;
$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
/**
* Fires after the header image is set or an error is returned.
* Filters the attachment file path after the custom header or background image is set.
*
* Used for file replication.
*
* @since 2.1.0
*
* @param string $file Path to the file.
* @param int $attachment_id Attachment ID.
*/
do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication.
$file = apply_filters( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication.
return $this->finished();
} elseif ( $width > $max_width ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-beta4-56928';
$wp_version = '6.4-beta4-56929';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.