Make WordPress Core

Changeset 56929

Timestamp:
10/13/2023 12:18:19 PM (10 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-custom-background.php

    r56599 r56929  
    572572        set_theme_mod( 'background_image_thumb', sanitize_url( $thumbnail[0] ) );
    573573
    574         /** This action is documented in wp-admin/includes/class-custom-image-header.php */
    575         do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication.
     574        /** This filter is documented in wp-admin/includes/class-custom-image-header.php */
     575        $file = apply_filters( 'wp_create_file_in_uploads', $file, $id ); // For replication.
     576
    576577        $this->updated = true;
    577578    }
  • trunk/src/wp-admin/includes/class-custom-image-header.php

    r56599 r56929  
    883883
    884884            /**
    885              * Fires after the header image is set or an error is returned.
     885             * Filters the attachment file path after the custom header or background image is set.
     886             *
     887             * Used for file replication.
    886888             *
    887889             * @since 2.1.0
     
    890892             * @param int    $attachment_id Attachment ID.
    891893             */
    892             do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication.
     894            ( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication.
    893895
    894896            return $this->finished();
Note: See TracChangeset for help on using the changeset viewer.