Categories :

Change and Update (WP) WordPress URLS in Database When Site is Moved to new Host

Change and Update WordPress Site URL Online

Table prefix :
Old URL :
New URL :

See here your Query…
<script type=”text/javascript”>
 function query()
var table_prefix = document.qury_form.table_prefix.value;
var old_url = document.qury_form.old_url.value;
var new_url = document.qury_form.new_url.value;

if (table_prefix == “” || old_url == “” || new_url == “”) {  

alert(“Fill all Vlaue(s)”);
return false;


var sql_quer=”UPDATE “+table_prefix+”options SET option_value = replace(option_value, ‘”+old_url+”‘, ‘”+new_url+”‘) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; <br>UPDATE “+table_prefix+”posts SET guid = replace(guid, ‘”+old_url+”‘,'”+new_url+”‘);<br>UPDATE “+table_prefix+”posts SET post_content = replace(post_content, ‘”+old_url+”‘, ‘”+new_url+”‘);<br>UPDATE “+table_prefix+”postmeta SET meta_value = replace(meta_value,'”+old_url+”‘,'”+new_url+”‘);<br>”

document.getElementById(‘sql_query’).innerHTML = sql_quer;
<form name=”qury_form”>
<td>Table prefix</td><td> : </td>
<td><input type=”text” name=”table_prefix” placeholder=”wp_”></input></td>
<td>Old URL</td><td> : </td>
<td><input type=”text” name=”old_url” placeholder=”http://www.oldurl” ></input></td>
<td>New URL</td><td> : </td>
<td><input type=”text” name=”new_url” placeholder=”http://www.newurl”></input></td>
<input type=”button” value=”submit” onClick=”query();”></input>
<input type=”reset” name=”reset”></input>
<div style=”border:1px solid;padding: 10px; margin: 10px;” id=”sql_query”>See here your Query…</div>


Leave a Reply

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