From c2931cd0c5f0e7746c08cd773828679b62f262e5 Mon Sep 17 00:00:00 2001 From: Aleksandar Atanasov Date: Thu, 5 Feb 2026 09:21:43 +0200 Subject: [PATCH 1/3] Add post Cloudinary asset check --- php/class-assets.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/php/class-assets.php b/php/class-assets.php index 661aa9c4..6eed15c9 100644 --- a/php/class-assets.php +++ b/php/class-assets.php @@ -494,18 +494,37 @@ protected function activate_parents() { } } } - // Get the disabled items. foreach ( $this->asset_parents as $url => $parent ) { if ( isset( $this->active_parents[ $url ] ) ) { continue; } + + if ( ! $this->is_post_cloudinary_asset( $parent->ID ) ) { + continue; + } + $this->purge_parent( $parent->ID ); // Remove parent. wp_delete_post( $parent->ID ); } } + /** + * Check if a post is a Cloudinary asset. + * + * @param int $post_id The post ID to check. + * + * @return bool + */ + public function is_post_cloudinary_asset( $post_id ) { + if ( get_post_type( $post_id ) === self::POST_TYPE_SLUG ) { + return true; + } + + return false; + } + /** * Activate a parent asset path. * @@ -569,6 +588,10 @@ public function create_asset_parent( $path, $version ) { * @param callable $callback The callback function to execute on each post. */ private function process_parent_assets( $parent_id, $callback ) { + if ( ! $this->is_post_cloudinary_asset( $parent_id ) ) { + return; + } + $query_args = array( 'post_type' => self::POST_TYPE_SLUG, 'posts_per_page' => 100, @@ -626,6 +649,10 @@ public function purge_parent( $parent_id ) { $this->process_parent_assets( $parent_id, function ( $post_id ) { + if ( ! $this->is_post_cloudinary_asset( $post_id ) ) { + return; + } + wp_delete_post( $post_id ); } ); From b14333aed81260432a41e07c4919d5d5d6d31a69 Mon Sep 17 00:00:00 2001 From: Aleksandar Atanasov Date: Thu, 5 Feb 2026 09:52:40 +0200 Subject: [PATCH 2/3] Improve down_sync_asset --- php/class-media.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/php/class-media.php b/php/class-media.php index a20a89d9..8b77c5f1 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -2285,8 +2285,7 @@ function ( $value, $key ) use ( &$asset ) { */ public function down_sync_asset() { $nonce = Utils::get_sanitized_text( 'nonce', INPUT_POST ); - if ( wp_verify_nonce( $nonce, 'wp_rest' ) ) { - + if ( is_user_logged_in() && wp_verify_nonce( $nonce, 'wp_rest' ) && current_user_can( 'upload_files' ) ) { $asset = $this->get_asset_payload(); // Set a base array for pulling an asset if needed. $base_return = array( From 19ff8c2465622c028a2cbd774a16578e9de72d11 Mon Sep 17 00:00:00 2001 From: Aleksandar Atanasov Date: Thu, 5 Feb 2026 10:30:04 +0200 Subject: [PATCH 3/3] Add POT Changes --- languages/cloudinary.pot | 82 ++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/languages/cloudinary.pot b/languages/cloudinary.pot index 853201ef..0c0b7257 100644 --- a/languages/cloudinary.pot +++ b/languages/cloudinary.pot @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Cloudinary STABLETAG\n" "Report-Msgid-Bugs-To: https://github.com/cloudinary/cloudinary_wordpress\n" -"POT-Creation-Date: 2026-02-02 12:12:12+00:00\n" +"POT-Creation-Date: 2026-02-05 08:29:24+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -63,11 +63,11 @@ msgstr[1] "" msgid "No items found." msgstr "" -#: php/cache/class-cache-point.php:961 php/class-assets.php:1265 +#: php/cache/class-cache-point.php:961 php/class-assets.php:1292 msgid "Cloudinary Asset" msgstr "" -#: php/cache/class-cache-point.php:962 php/class-assets.php:1266 +#: php/cache/class-cache-point.php:962 php/class-assets.php:1293 msgid "Post type to represent a non-media library asset." msgstr "" @@ -87,114 +87,114 @@ msgstr "" msgid "Enable Cloudinary status" msgstr "" -#: php/class-assets.php:818 +#: php/class-assets.php:845 msgid "Caching" msgstr "" -#: php/class-assets.php:829 +#: php/class-assets.php:856 msgid "Creating shadow assets" msgstr "" -#: php/class-assets.php:840 +#: php/class-assets.php:867 msgid "Updating asset storage" msgstr "" -#: php/class-assets.php:1309 +#: php/class-assets.php:1336 msgid "Additional Asset Sync Settings" msgstr "" -#: php/class-assets.php:1329 +#: php/class-assets.php:1356 msgid "Additional asset sync settings" msgstr "" -#: php/class-assets.php:1330 +#: php/class-assets.php:1357 msgid "" "Enabling additional asset syncing will sync the toggled assets with " "Cloudinary to make use of advanced optimization and CDN delivery " "functionality." msgstr "" -#: php/class-assets.php:1331 +#: php/class-assets.php:1358 msgid "Enable additional asset syncing" msgstr "" -#: php/class-assets.php:1370 +#: php/class-assets.php:1397 msgid "External Asset Sync Settings" msgstr "" -#: php/class-assets.php:1419 php/class-cache.php:617 +#: php/class-assets.php:1446 php/class-cache.php:617 msgid "Plugin" msgstr "" -#: php/class-assets.php:1455 php/class-cache.php:793 +#: php/class-assets.php:1482 php/class-cache.php:793 msgid "Plugins" msgstr "" -#: php/class-assets.php:1473 php/class-cache.php:810 +#: php/class-assets.php:1500 php/class-cache.php:810 msgid "Deliver assets from all plugin folders" msgstr "" -#: php/class-assets.php:1505 php/class-cache.php:653 +#: php/class-assets.php:1532 php/class-cache.php:653 msgid "Theme" msgstr "" -#: php/class-assets.php:1537 php/class-cache.php:844 +#: php/class-assets.php:1564 php/class-cache.php:844 msgid "Themes" msgstr "" -#: php/class-assets.php:1555 php/class-cache.php:861 +#: php/class-assets.php:1582 php/class-cache.php:861 msgid "Deliver all assets from active theme." msgstr "" -#: php/class-assets.php:1580 php/class-assets.php:1615 php/class-cache.php:685 +#: php/class-assets.php:1607 php/class-assets.php:1642 php/class-cache.php:685 #: php/class-cache.php:896 msgid "WordPress" msgstr "" -#: php/class-assets.php:1589 php/class-cache.php:669 +#: php/class-assets.php:1616 php/class-cache.php:669 msgid "WordPress Admin" msgstr "" -#: php/class-assets.php:1596 php/class-cache.php:676 +#: php/class-assets.php:1623 php/class-cache.php:676 msgid "WordPress Includes" msgstr "" -#: php/class-assets.php:1633 php/class-cache.php:913 +#: php/class-assets.php:1660 php/class-cache.php:913 msgid "Deliver all assets from WordPress core." msgstr "" -#: php/class-assets.php:1659 php/class-assets.php:1685 php/class-cache.php:709 +#: php/class-assets.php:1686 php/class-assets.php:1712 php/class-cache.php:709 #: php/class-cache.php:948 msgid "Content" msgstr "" -#: php/class-assets.php:1666 php/class-cache.php:700 +#: php/class-assets.php:1693 php/class-cache.php:700 msgid "Uploads" msgstr "" -#: php/class-assets.php:1703 php/class-cache.php:965 +#: php/class-assets.php:1730 php/class-cache.php:965 msgid "Deliver all content assets from WordPress Media Library." msgstr "" -#: php/class-assets.php:1727 +#: php/class-assets.php:1754 msgid "Enable external assets" msgstr "" -#: php/class-assets.php:1728 +#: php/class-assets.php:1755 msgid "" "Enabling external assets allows you to sync assets from specific external " "sources with Cloudinary." msgstr "" -#: php/class-assets.php:1738 +#: php/class-assets.php:1765 msgid "Domains for each external source." msgstr "" -#: php/class-assets.php:1741 +#: php/class-assets.php:1768 msgid "Enter a domain" msgstr "" -#: php/class-assets.php:1742 +#: php/class-assets.php:1769 msgid "Press ENTER or SPACE or type comma or tab to continue." msgstr "" @@ -521,49 +521,49 @@ msgstr "" msgid "Cloudinary" msgstr "" -#: php/class-media.php:2426 +#: php/class-media.php:2425 msgid "The delivery for this asset is disabled." msgstr "" -#: php/class-media.php:2430 +#: php/class-media.php:2429 msgid "Not syncable. This is an external media." msgstr "" -#: php/class-media.php:2434 +#: php/class-media.php:2433 msgid "This media is Fetch type." msgstr "" -#: php/class-media.php:2438 +#: php/class-media.php:2437 msgid "This media is Sprite type." msgstr "" -#: php/class-media.php:2448 +#: php/class-media.php:2447 msgid "Not Synced" msgstr "" -#: php/class-media.php:2453 +#: php/class-media.php:2452 msgid "Synced" msgstr "" -#: php/class-media.php:3112 +#: php/class-media.php:3111 msgid "No Cloudinary filters" msgstr "" -#: php/class-media.php:3212 +#: php/class-media.php:3211 msgid "Media Settings" msgstr "" -#: php/class-media.php:3215 +#: php/class-media.php:3214 msgid "Media Display" msgstr "" -#: php/class-media.php:3219 php/ui/component/class-plan-details.php:119 +#: php/class-media.php:3218 php/ui/component/class-plan-details.php:119 #: php/ui/component/class-plan-status.php:128 #: ui-definitions/settings-pages.php:568 ui-definitions/settings-sidebar.php:44 msgid "Transformations" msgstr "" -#: php/class-media.php:3220 +#: php/class-media.php:3219 msgid "" "Cloudinary allows you to easily transform your images on-the-fly to any " "required format, style and dimension, and also optimizes images for minimal " @@ -572,7 +572,7 @@ msgid "" "transformation and delivery URLs." msgstr "" -#: php/class-media.php:3225 ui-definitions/settings-image.php:174 +#: php/class-media.php:3224 ui-definitions/settings-image.php:174 #: ui-definitions/settings-pages.php:594 ui-definitions/settings-video.php:260 msgid "See examples" msgstr ""