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-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    }
Note: See TracChangeset for help on using the changeset viewer.