In my theme, many URLs are generated based on bloginfo('template_directory'), for example, below is a snippet in the header
<link rel="apple-touch-icon" sizes="64x64" href="<?php bloginfo('template_directory'); ?>/apple-touch-icon.png">
Now for my site origin.example.com, I have create a Cloudfront distribution xxx.cloudfront.net.
To make sure the URLs in the web pages will use the URLs in xxx.cloudfront.net, not origin.example.com, I modify wp-config.php and add the following lines:
define( 'WP_SITEURL', 'https://xxx.cloudfront.net' );
define( 'WP_HOME', 'https://xxx.cloudfront.net' );
However, even after this, when I load a page from https://origin.example.com, I still see this:
<link rel="apple-touch-icon" sizes="64x64" href="https://origin.example.com/wp-content/themes/datanumen/apple-touch-icon.png">
So I doubt whether bloginfo('template_directory') is generated based on WP_SITEURL and WP_HOME, or actually based on other values in the database?
I check https://developer.wordpress.org/reference/functions/bloginfo/ and it does not mention that clearly, in the comment there is an example implies that the values comes from WP_SITEURL and WP_HOME.
Update
There must be something wrong. I have:
- Add the following line to wp-config.php:
define( 'WP_CONTENT_URL', 'https://xxx.cloudfront.net' );
Use "Better Search Replace" to replace all origin.example.com with xxx.cloudfront.net.
Deactive WP Rocket so that cache will not working.
Even doing all these, my page still use https://origin.example.com/wp-content/themes/xxx/ as the value of bloginfo('template_directory').