mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56929 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
Reference in New Issue
Block a user