Make WordPress Core


Ignore:
Timestamp:
10/13/2023 12:18:19 PM (20 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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            $file = apply_filters( '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.