Are you looking for a PHP script that can reset the WordPress Address (URL) of your blog? or Did you accidentally change the settings of the Blog Address (URL) from General settings then you were not able to access your blog because of this modification that you made?

Wordpress Adress URL

Now to solve my problem, I have prepared a PHP script to reset it to my original blog settings. Here’s the PHP script for the WordPress address URL reset that I used:

<?php
$dbhost = ‘localhost’;
$dbuser = ‘user_name’;
$dbpass = ‘password‘;
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die(’Error connecting to mysql’);
$dbname = ‘databasename’;
mysql_select_db($dbname);
$query  = “UPDATE wp_options SET option_value = ‘http://www.urdomain.com‘ WHERE `wp_options`.`option_id` =1 AND `wp_options`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = ’siteurl’ LIMIT 1 ;”;
$result = mysql_query($query);
$query = “UPDATE wp_options SET option_value = ‘http://www.urdomain.com’ WHERE `wp_options`.`option_id` =39 AND `wp_options`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = ‘home’ LIMIT 1 ;”;
$result = mysql_query($query);
mysql_close($conn);
?>

You can download the whole script here: reseturl.txt and modify the portion (underlined option above) that is applicable to your site. Rename the file to reseturl.php then upload it to your website. Execute it and that’s all it will reset the WordPress Address (URL) and Blog Address (URL) to appropriate URL.

I hope this script will solve your WordPress problem.

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

22 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
ashley
ashley
13 years ago

after searching the solution to my problem.. i just follow ur instruction and its works 100% for me..thank you very much..sori for bad english..Thanks and God bless.. you are the best..

Davide
Davide
13 years ago
eamills
15 years ago

Again I screwed up, and again this helped! Thanks again

abhijeet
15 years ago

Thanks for this.
I was really fall in Big problem.
You save me!
Thanks A lot!

shezoom
shezoom
15 years ago

I continue to receive errors…and have tried several variations on the reseturl.php including wonderful statements such as

Parse error: syntax error, unexpected T_STRING in /home/content/m/b/s/mbsuccess777/html/blog/reseturl.php on line 5

So then I took a look at the wp-config.php file…located the database name and info…and now get things like

Error establishing a database connection

Could I forward you both files … am so lost I’m feeling blonder each and every moment.

shezoom
shezoom
15 years ago

this sounds awesome! however how to you actually install it/run it? I made all of the recommended modifications in the script within notepad, saved it as a .php file, uploaded it to my site.

Just don’t know where to go from here…

Sci-Fi Si
15 years ago

Great stuff! Thanks for that 🙂

Sci-Fi Si
15 years ago

It’s ok thanks. I went in to MySQL query browser and reset it there. Even though I couldn’t get the script working it does have the table name and ID number so I knew which values to change back.

Many thanks

Sci-Fi Si
15 years ago

Humm…

I have copied the script you have above into a text editor and saved it as reseturl.php but unfortunately I get:

PHP Parse error: parse error in \thisisnotmywebsiteurl\reseturl.php on line 5

I then tried to download the script link you have reseturl.txt, but unfortunately I get a Error 404.

Do you know what is happening??

Many thanks

eamills
16 years ago

Thanks so much for this! I’m a complete novice and I was able to get this work! Thanks again. This should be in the official WordPress documentation.