Skip to content

Commit 037b58a

Browse files
author
Marco Pereirinha
committed
Do not override the attachament URL on upload
1 parent 8cc6028 commit 037b58a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ public function attachment_url( $url, $attachment_id ) {
633633
if ( false !== $previous_url ) {
634634
return substr( $url, $previous_url );
635635
}
636-
if ( ! doing_action( 'wp_insert_post_data' ) && false === $this->in_downsize ) {
636+
if ( ! doing_action( 'wp_insert_post_data' ) && false === $this->in_downsize && ! apply_filters( 'cloudinary_doing_upload', '__return_false' ) ) {
637637
if ( $this->cloudinary_id( $attachment_id ) ) {
638638
$url = $this->cloudinary_url( $attachment_id );
639639
}

cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ public function upload_asset( $attachment_id ) {
217217
// Run the upload Call.
218218
$result = $this->connect->api->upload( $attachment_id, $options );
219219

220+
remove_filter( 'cloudinary_doing_upload', '__return_true' );
221+
220222
if ( ! is_wp_error( $result ) ) {
221223

222224
// Check that this wasn't an existing.

0 commit comments

Comments
 (0)