When using the Cloudinary WordPress plugin, by default, you can only sync media assets that are defined as internal media assets i.e the guid of the assets has to belong to the domain of your WordPress website.
How to know which assets are internal or external?
Usually, when the sync process kicks off, the plugin will try to sync internal assets to Cloudinary while for external media assets, you should see a blue icon with a Not syncable. This is an external media. message when you hover the icon as you can see below:
In which cases my media assets can be external?
It mostly happens when migrating your website to another domain or when migrating your website to a staging/dev environment while keeping the original database.
How to sync those external media assets?
There are 2 ways to fix it depending on the guid of those assets being accessible or not, so you will need to find out first what the guid of those assets look like by following those instructions:
If you aren't a developer or you don't have access to the database:
- Enable the Cloudinary System Report as explained here.
- In your Media Library, click on the asset to edit it:
- Scroll down to the Cloudinary Metadata Viewer and locate the guid of the asset by scrolling the viewer to its last line.
If you are a developer or you have access to the database:
- Connect to your database and launch the following query:
select id, guid from wp_posts where id='your_post_id';
When you have the guid URL, you can paste it into your browser and see if it is accessible. If it is accessible, you can go to General Settings under the Cloudinary plugin and scroll down to the External Asset Sync Settings section and add the domain of the guid URL to the whitelist and save your changes:
The assets should now start being synced to Cloudinary.
If it is not accessible, you need to find out where this asset is stored. Usually, it happens if you have migrated your assets to a new domain and deleted the previous one while the guid URLs use the previous domain so you will need to rewrite the URLs of the guid values. For example, https://dev-loic-cloudinary.pantheonsite.io/wp-content/uploads/2022/02/img.png is not accessible but https://dev-loic-cloudinary-play.pantheonsite.io/wp-content/uploads/2022/02/img.png is.
If you aren't a developer or you don't have access to the database:
- Install the Better Search Replace plugin and go to Tools > Better Search Replace.
- In the Search for field, add the non-accessible domain.
- In the Replace with field, add the accessible domain.
- Select the wp_posts table and check the Replace GUIDs box.
- Uncheck the Run as dry run? box to replace the URLs. You can leave it checked as a first attempt to check the results before altering the database.
If you are a developer or you have access to the database:
- Connect to your database and launch the following query:
update wp_posts set guid = replace (guid, 'old_domain','new_domain') where guid like '%old_domain%'
When the query either from the database or via the Better Search Replace plugin has completed, the assets should now start being synced to Cloudinary.
Comments
0 comments
Please sign in to leave a comment.