Warning: WP_HOME Constant Contains A Variable
-
We are using a “WPSSO Core Standard” plugin for structured data and it returns a warning that the WP_HOME Constant Contains A Variable in our wp-config.php file.
The WP_HOME constant definition in your wp-config.php file contains a variable. WordPress uses the WP_HOME constant to provide a single unique canonical URL for each webpage and Media Library content. A changing WP_HOME value will create different canonical URLs in your webpages, leading to duplicate content penalties from Google, incorrect social share counts, possible broken media links, mixed content issues, and SSL certificate errors Please update your wp-config.php file and provide a fixed, non-variable value for the WP_HOME constant.
Here is the relevant code from wp-config.php
* The WP_SITEURL and WP_HOME options are configured to access from any hostname or IP address. * If you want to access only from an specific domain, you can modify them. For example: * define('WP_HOME','https://example.com'); * define('WP_SITEURL','https://example.com'); * */ if ( defined( 'WP_CLI' ) ) { $_SERVER['HTTP_HOST'] = 'localhost'; } define('WP_SITEURL','https://' . $_SERVER['HTTP_HOST'] . '/'); define('WP_HOME','https://' . $_SERVER['HTTP_HOST'] . '/'); /** Absolute path to the WordPress directory. */ if ( ! defined( 'ABSPATH' ) ) { define( 'ABSPATH', dirname( __FILE__ ) . '/' ); }
How can we address this ?
Thanks
- The topic ‘Warning: WP_HOME Constant Contains A Variable’ is closed to new replies.