Change WordPress URL in Database with phpMyAdmin and SQL query

Replace WordPress old URL to new URL with SQL Query

First, make sure you are on correct database on phpMyAdmin.

September 22, 2022

Put the below code under the SQL tab and press go.

Before you press go make sure you change youroldsite.com and yournewsite.com

SQL Query
UPDATE wp_options SET option_value = replace(option_value, 'https://youroldsite.com', 'https://yournewsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'https://youroldsite.com','https://yournewsite.com');UPDATE wp_posts SET post_content = replace(post_content, 'https://youroldsite.com', 'https://yournewsite.com'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'https://youroldsite.com','https://yournewsite.com');

Leave a Reply

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

3 − two =

skype

Need Coding Help?

Connect Skype

ACF

Elementor

JavaScript

jQuery

Others

PHP

WooCommerce

WordPress

WordPress Ajax Search without plugin [ Easy ]

WordPress Ajax Search without plugin. Fully custom ...

WP Post Query with variable item column size

...

Protected: WP user Login Notification

This code is Protected. Contact Admin for password

Remove Website field from WordPress comment & Change cookies remember text

Remove Website field from WordPress comment & Chan ...

WordPress Next and Previous Post

WordPress Next and Previous Post navigation for cu ...

top