I have a site where I used http://example.com
, but if I change my site URL to http://example.co.uk
or http://examplesite.co.uk
which are all same site.
If I changed anything in the above urls it should override theme url.
Currently it is showing from the database value.
I used
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] );
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'].'/');
but for theme &plugin url it is not working it shows http://example.co.uk
I want as http://example.com
if user types the same
In a comment I pointed you to an existing answer that I figured would solve your problem.
You replied
The answer I pointed you to is easily adaptable for that:
In your
wp-config.php
file, after (!)require_once ABSPATH . 'wp-settings.php';
do the following:This is assuming that
example.com
is the value set in your settings/DB.Use the relocate method:
http://codex.wordpress.org/Changing_The_Site_URL#Relocate_method
(Also, if you haven’t, replace the URL in MySQL by using http://interconnectit.com/products/search-and-replace-for-wordpress-databases/)
Instead of
$_SERVER['HTTP_HOST']
write hard coded value and check if it is working.