Changeset 55202
- Timestamp:
- 02/03/2023 12:45:24 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r55199 r55202 706 706 * Retrieves attached file path based on attachment ID. 707 707 * 708 * Will return intermediate size path if $size param is provided. 709 * 710 * By default the path will go through the 'get_attached_file' filter, but 711 * passing a true to the $unfiltered argument of get_attached_file() will 712 * return the file path unfiltered. 713 * 714 * The function works by getting the single post meta name, named 715 * '_wp_attached_file' and returning it. This is a convenience function to 716 * prevent looking up the meta name and provide a mechanism for sending the 717 * attached filename through a filter. 708 * Will return intermediate size path if the `$size` parameter is provided. 709 * 710 * By default the path will go through the {@see 'get_attached_file'} filter, but 711 * passing `true` to the `$unfiltered` argument will return the file path unfiltered. 712 * 713 * The function works by retrieving the `_wp_attached_file` post meta value. 714 * This is a convenience function to prevent looking up the meta name and provide 715 * a mechanism for sending the attached filename through a filter. 718 716 * 719 717 * @since 2.0.0 720 * @since 6.2 The `$size` parameter was added718 * @since 6.2.0 The `$size` parameter was added. 721 719 * 722 720 * @param int $attachment_id Attachment ID. 723 * @param bool $unfiltered Optional. Whether to apply filters. Default false. 721 * @param bool $unfiltered Optional. Whether to skip the {@see 'get_attached_file'} filter. 722 * Default false. 724 723 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array 725 * of width and height values in pixels (in that order). Default ''. 726 * 724 * of width and height values in pixels (in that order). Default empty string. 727 725 * @return string|false The file path to where the attached file should be, false otherwise. 728 726 */ 729 727 function get_attached_file( $attachment_id, $unfiltered = false, $size = '' ) { 730 728 731 // Check for intermediate sizes first, otherwise fall back to original attachment size729 // Check for intermediate sizes first, otherwise fall back to the original attachment size. 732 730 if ( ! empty( $size ) ) { 733 731 $intermediate_image = image_get_intermediate_size( $attachment_id, $size ); … … 735 733 return false; 736 734 } 735 737 736 $file = $intermediate_image['path']; 738 737 } else {
Note: See TracChangeset
for help on using the changeset viewer.