Change WordPress URL through functions.php file

Changing the WordPress URL can be done by editing the functions.php located in the theme folder, in most of the webservers the location will be as below

/home/site/public_html/wp-content/themes/mytheme/functions.php

Once you open the functions.php files add the below lines (replace the URL with the new one) immediately after <?php

 

update_option( 'siteurl', 'https://www.newurl.net' );
update_option( 'home', 'https://www.newurl.net' );

 

Save the file and exit, now open the admin page of the wordpress by using the new URL as below

Refresh the page couple of time, this will will update the base URL in the database with the new URL, once that is done your site will be fully functional with the new URL.

 

Updated: October 7, 2018 — 2:40 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

nineteen − five =

www.hostingdada.net © 2016