Media: Pass through the `$unfiltered` param to `get_attached_file()` in `wp_get_original_image_path()`.
Props ianmjones, joemcgill, azaozz. Fixes #48421. Built from https://develop.svn.wordpress.org/trunk@47274 git-svn-id: http://core.svn.wordpress.org/trunk@47074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4489fb7b36
commit
a2accf4db7
|
@ -7177,17 +7177,19 @@ function get_available_post_mime_types( $type = 'attachment' ) {
|
||||||
* to the originally uploaded image file.
|
* to the originally uploaded image file.
|
||||||
*
|
*
|
||||||
* @since 5.3.0
|
* @since 5.3.0
|
||||||
|
* @since 5.4.0 Added the `$unfiltered` parameter.
|
||||||
*
|
*
|
||||||
* @param int $attachment_id Attachment ID.
|
* @param int $attachment_id Attachment ID.
|
||||||
|
* @param bool $unfiltered Optional. Passed through to `get_attached_file()`. Default false.
|
||||||
* @return string|false Path to the original image file or false if the attachment is not an image.
|
* @return string|false Path to the original image file or false if the attachment is not an image.
|
||||||
*/
|
*/
|
||||||
function wp_get_original_image_path( $attachment_id ) {
|
function wp_get_original_image_path( $attachment_id, $unfiltered = false ) {
|
||||||
if ( ! wp_attachment_is_image( $attachment_id ) ) {
|
if ( ! wp_attachment_is_image( $attachment_id ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$image_meta = wp_get_attachment_metadata( $attachment_id );
|
$image_meta = wp_get_attachment_metadata( $attachment_id );
|
||||||
$image_file = get_attached_file( $attachment_id );
|
$image_file = get_attached_file( $attachment_id, $unfiltered );
|
||||||
|
|
||||||
if ( empty( $image_meta['original_image'] ) ) {
|
if ( empty( $image_meta['original_image'] ) ) {
|
||||||
$original_image = $image_file;
|
$original_image = $image_file;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.4-alpha-47273';
|
$wp_version = '5.4-alpha-47274';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue