Make WordPress Core


Ignore:
Timestamp:
05/10/2024 06:57:53 PM (9 months ago)
Author:
swissspidy
Message:

REST API: Ensure attachments are uploaded to the post's year/month folder.

If organizing uploads into month- and year-based folders, uploading an attachment to an existing post should store the file in wp-content/uploads/<year>/<month> based on the post's publish date. This is in line with the behavior in classic editor / the media modal.

Props swissspidy, adamsilverstein, timothyblynjacobs, skithund, sergeybiryukov, patricia70.
Fixes #61189.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r57987 r58130  
    23452345 * @uses _wp_upload_dir()
    23462346 *
    2347  * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
    2348  * @param bool   $create_dir Optional. Whether to check and create the uploads directory.
    2349  *                           Default true for backward compatibility.
    2350  * @param bool   $refresh_cache Optional. Whether to refresh the cache. Default false.
     2347 * @param string|null $time          Optional. Time formatted in 'yyyy/mm'. Default null.
     2348 * @param bool        $create_dir    Optional. Whether to check and create the uploads directory.
     2349 *                                   Default true for backward compatibility.
     2350 * @param bool        $refresh_cache Optional. Whether to refresh the cache. Default false.
    23512351 * @return array {
    23522352 *     Array of information about the upload directory.
     
    24202420 * @access private
    24212421 *
    2422  * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
     2422 * @param string|null $time Optional. Time formatted in 'yyyy/mm'. Default null.
    24232423 * @return array See wp_upload_dir()
    24242424 */
     
    28722872 * @param null|string $deprecated Never used. Set to null.
    28732873 * @param string      $bits       File content
    2874  * @param string      $time       Optional. Time formatted in 'yyyy/mm'. Default null.
     2874 * @param string|null $time       Optional. Time formatted in 'yyyy/mm'. Default null.
    28752875 * @return array {
    28762876 *     Information about the newly-uploaded file.
Note: See TracChangeset for help on using the changeset viewer.