I’m migrating a current WordPress 4.7.3 site to become full SSL and when I log into the site using https:// prefix the function calls to get_template_directory_uri() and bloginfo('template_directory') will skip the theme part of the path.

An example line that I’m able to notice is this:

wp_enqueue_style('fancybox', get_template_directory_uri() . '/assets/css/fancybox/jquery.fancybox.css', false, null);

This is the current working result sample if I request the page with http://example.com

http://example.com/wp-content/themes/mytheme/assets/css/fancybox/jquery.fancybox.css

This is then the result calling with https://example.com

https://example.com/assets/css/fancybox/jquery.fancybox.css

I’ve recently migrated other sites with same WP version and legacy templates that use the same functions and they just work so that’s why I’m intrigued if this is by any chance a specific wp_option or other setting that would be causing this behavior that I’m not being able to figure out.

For clarity, both siteurl and home are set to https://example.com and, of course, this is not the actual domain name.

Any clues on why the /wp-content/themes/mytheme is been skipped on the https:// call?

Read more here: WordPress get_template_directory_uri() and bloginfo(‘template_directory’) return different results with HTTPS


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: