I recently added https to my site, and noticed that I was no longer to access non-https images within my designs due to a CORS error. While this can be resolved with some simple redirect or configuration rules, it also points out that there may be other existing issues in the future with a few different scenarios. It would be wonderful if FPD had an option to update URLS when the following scenarios take place
Scenario 1: User changes URL from HTTP to HTTPS, or adds WWW
Scenario 2: Cases when development is done on a different domain ( local / staging / production )
Scenario 3: Migrating to a new domain name (the problem I will inevitably face)
There are 3 fpd tables which write the URLs into various fields for things like masks and image elements. Additionally, these URLs also get written to wp_woocommerce_order_itemmeta with the meta_key _fpd_data once a customer purchases an item.
Exports (when URLs are correct) do not store links. They may however, not be capable of zipping all images in the event that a CORS error occurs. This may need to be looked into further.
Other tools are available to fix these Issues, but I think as a quality of life enhancement or easy option for users to fix these issues without in depth knowledge for themselves. A link could also be placed on the CORS popup explaining this could be one of their issues with a link to an inbuilt URL tool or proper KB article to use the other tools.
This is not a guide to update your domain name, or change all instances in the database. This covers only the FPD entries I needed to fix.
Generally I use a tool like Velvet Blues Update URLs, wp-cli via the WP CLI Search-Replace function when I change domains, but in the case of Velvet blues, FPD uses custom tables which It ignores. Better Search Replace DOES allow you to specify tables. All three options are also capable of dealing with PHP Serialized values.
Sometimes however, URLs get stored escaped such as https:\/\/example.com and are easily missed, forgotten or just unknown.
WARNING: Running the following commands can damage your site, ensure you create backups before preforming any actions
in my case, I could have used Better Search Replace to select all 3 FPD tables, along with woocommerce_order_itemmeta
USE THE PROPER URL FOR YOUR SITE
- Update non encoded url
Search for: http://example.com Replace with: https://example.com
- Update escaped url
Search for: http:\/\/example.com Replace with: http:\/\/example.com
In the Tools page of the backend and you can easily update all images sources to your new domain and protocol.