Opened 3 years ago
Last modified 3 years ago
#53308 new defect (bug)
The WP_CONTENT_URL constant contains an incorrect URL
Reported by: | webtemyk | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.7.2 |
Component: | Bootstrap/Load | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description (last modified by )
In one of the latest versions of WordPress, we added this code to the file wp-config.php:
<?php if ( ! defined( 'WP_CLI' ) ) { define( 'WP_SITEURL', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] ); define( 'WP_HOME', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] ); }
However, when declaring some constants, the site URL continues to be taken from the option in the database:
<?php define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
The problem occurs when the site administrator moves the site to another domain or switches to HTTPS, but does not change the URL in the database. At the same time, WordPress continues to work, even with the wrong address in the option in the database, but the old site address turns out to be in the constant
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @webtemyk and welcome to trac!
Prior to running the code to define
WP_CONTENT_URL
WordPress adds a filter to override thesiteurl
andhomeurl
option if the constants are set, the filters are added in the wp-includes/default-filters.php file, and the for the filters check if the constants are defined.However, if you have set your site up in multisite mode these filters do not run. Is your site running as a multisite install?
Thanks,
Peter