Replace Live Site Url with Local Site URL in wordpress database
Replace Live Site Url with Local Site URL in wordpress database
In this session, we are going to try to solve the "Replace Live Site Url with Local Site URL in wordpress database" puzzle by using the computer language.
You can use SQL query to update the Live site URL with your Local site URL. You have to simply run the query to update the value or you can also update it manually by using phpmyadmin.
-
Replace Site URL using SQL query in wordpress
UPDATE wp_options SET option_value = replace(option_value, 'http://www.yoursitename.com', 'http://localhost/projectname') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET post_content = replace(post_content, 'http://www.yoursitename.com', 'http://localhost/projectname'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.yoursitename.com','http://localhost/projectname');
First, Login in to your database via phpMyAdmin and choose database. After that, you have to click on SQL tab and paste the above code in it and hit go button to update the URL.
-
Manually update site URL of WordPress database
Follow below step to update the site URL manually in wordpress database.
- Log into the database via phpMyAdmin ( cPanel / Plesk / Web Hosting / Managed WordPress ).
- Choose your database on which you are working on.
- Select table name wp_options.
- Now update the value of
option_value
column (Generally it exists at first two row), Which contain value like (https://yourdomain.com). Now you have to update all these value with new values as per your requirement (eg: http://localhost/yourwordpress-project).
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Wordpress
- Function to get the post id in while (have_posts()) : the_post();
- Add new class to body tag in wordpress
- Remove every class and ID from the wp_nav_menu
- Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/xxx/public_html/wp-includes/plugin.php on line xxx
- Remove class from body tag in wordpress
- How to hide PHP Warnings and Notices in WordPress?
- Show template file name in wordpress
- Create shortcode in wordpress functions php
- Custom post type in wordpress
- How to display author avatar in Wordpress 5
- Create a accordion plugin in wordpress
- How to use shop in product category and product permalink in woocommerce