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?
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.
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..
Look at this Easy Tip:
http://howwordpressto.blogspot.com/2011/06/how-to-reset-url-wordpress.html
Again I screwed up, and again this helped! Thanks again
Thanks for this.
I was really fall in Big problem.
You save me!
Thanks A lot!
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.
You may send it to me shezoom and let me see if I can do anything about it.
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…
Hi shezoom! it should be uploaded on your server where your WP was installed. Then change its attribute to executable (CHMOD 777) then run it via yoururl.com/reseturl.php
make sure you delete the file after you use it.
Great stuff! Thanks for that 🙂
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
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
thanks, the URL changed when I transfer this site to another hosting. I’ve just corrected it, thanks. You can download it right now.
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.