Skip to content

Commit 722260f

Browse files
authored
Merge pull request #452 from cloudinary/feature/wp_get_original_image_url-fallback
Check if function exists before using it
2 parents 9215beb + 42d2c3d commit 722260f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

php/connect/class-api.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,10 @@ public function upload( $attachment_id, $args, $headers = array(), $try_remote =
388388
$url = $this->url( $resource, 'upload', true );
389389
$args = $this->clean_args( $args );
390390
$disable_https_fetch = get_transient( '_cld_disable_http_upload' );
391-
if ( wp_attachment_is_image( $attachment_id ) ) {
391+
if (
392+
function_exists( 'wp_get_original_image_url' ) &&
393+
wp_attachment_is_image( $attachment_id )
394+
) {
392395
$file_url = wp_get_original_image_url( $attachment_id );
393396
} else {
394397
$file_url = wp_get_attachment_url( $attachment_id );

0 commit comments

Comments
 (0)