Opened 8 months ago
#60308 new defect (bug)
Inconsistent return of urls / get_bloginfo() vs get_template_directory_uri()
Reported by: | luckyfella73 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.4.2 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
It doesn't seem to happen in all server environments but on a WP instance hosted on IONOS (former 1&1) I get unexpected returns when using: get_template_directory_uri()
- I'm calling the page including
https:
andwww.
in the browser. - I have
WP_HOME
andWP_SITEURL
configured having thewww.
included. - All urls relating to the page in the database have
www.
included. wp-admin/options-general.php
shows thewww.
in both urls
When trying to load assets (js files) using get_template_directory_uri()
to build the full url-path the www.
is omitted. Due to crossdomain restrictions the files don't get loaded of course.
After looking at my configuration to find the error I might have done I found out that I get the domain with www.
included when using get_bloginfo('url')
.
get_bloginfo('stylesheet_url')
on the other hand does not return www.
in the url. That is unexpected to me.
<?php // returns no 'www.' $get_template_directory_uri = get_template_directory_uri(); echo ("<p><code>get_template_directory_uri()</code>:<br>" . $get_template_directory_uri . "</p>"); // returns 'www.' $get_bloginfo_url = get_bloginfo('url'); echo ("<p><code>get_bloginfo('url')</code>:<br>" . $get_bloginfo_url . "</p>"); // returns no 'www.' $stylesheet_url = get_bloginfo('stylesheet_url'); echo ("<p><code>get_bloginfo('stylesheet_url')</code>:<br>" . $stylesheet_url . "</p>");
Environment:
- WordPress 6.4.2 (latest the time of writing)
- all plugins deactivated
- PHP 8.1.27
Note: See
TracTickets for help on using
tickets.