In this article we will show you the solution of update query in WordPress, WordPress stores all of its data, especially site URLs, in a MySQL database.
In order to update your WordPress URL, you must make some changes to some MySQL data.
If you just have one MySQL database, skip this section. If you have several databases, though, and are unsure which one is associated with your WordPress installation.
Using phpmyadmin to query databases, such as those for a wordpress site, is standard procedure.
To examine or modify the Site and Homepage urls, use MySql in a Console to query the (prefix) options table of the WordPress database.
They are configured inside the WordPress dashboard, however if they are wrong, logging in may be problematic.
As illustrated below, you can fix the urls by using phpmyadmin or MySql in a command prompt while inside the main WordPress directory.
Step By Step Guide On Update Query In WordPress :-
- Inside the wp-config.php file, WordPress saves the names of the MySQL databases and their login information. This file can be found in our root folder structure:
- Open File Manager in your hPanel by logging in.
- Click Go over to File Manager after selecting the domain name.
- To get DB NAME, open wp-config.php and look for it. The name of your database is the result of this parameter. My MySQL database, for instance, is called u923246418 gagap.
- Use the control panel on your website to access phpMyAdmin.
- Your databases are all listed in the left panel. Go to the SQL tab after choosing the one associated with your WordPress website.
- Type the following SQL statement here:UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');
- Click "Go." Along with the amount of altered rows, you will receive success notifications. Keep in mind that each WordPress website will have a different number of rows.
- Verifying the adjustments is the last step we need to accomplish. Check the option value of siteurl and home in the wp options table by opening it. Your new URL ought to be visible.
We just learnt how to use phpMyAdmin to alter WordPress URLs inside the MySQL database.
All of the aforementioned steps are rather simple, as we can see. Simply choose the proper database, then enter a few lines of code.
I hope this article on update query in WordPress helps you and the steps and method mentioned above are easy to follow and implement.