wp_siteurl in config
In WordPress,
WP_SITEURL is a constant that can be defined in the wp-config.php file to specify the WordPress address (URL). This constant determines the location of your WordPress core files and is used by the site_url() API function.Purpose of
WP_SITEURL in wp-config.php:-
When defined in
wp-config.php,WP_SITEURLtakes precedence over thesiteurlvalue stored in the WordPress database'swp_optionstable. -
Setting this constant can potentially reduce the number of database queries required to retrieve the site URL during page loads.
-
It is particularly useful for temporarily changing the WordPress address, such as during site migration or troubleshooting when you cannot access the WordPress admin dashboard.
-
Allows previewing a site on a temporary domain without altering the database, preventing redirection to the old server.
How to define
WP_SITEURL:- Access
wp-config.php: Connect to your server using FTP or your hosting provider's file manager and locate thewp-config.phpfile in your WordPress installation directory. - Edit the file: Open
wp-config.phpin a plain text editor. - Add the definition: Add the following line before the line that says
/* That's all, stop editing!Happy publishing.*/:
define('WP_SITEURL', 'http://yourdomain.com');