All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

Update Query In WordPress

Last Updated : Mar 11, 2024

Update Query In WordPress

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 :-

  1. 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:
  2. Open File Manager in your hPanel by logging in.
  3. Click Go over to File Manager after selecting the domain name.Update Query In WordPress
  4. 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.Update Query In WordPress
  5. Use the control panel on your website to access phpMyAdmin.
  6. Your databases are all listed in the left panel. Go to the SQL tab after choosing the one associated with your WordPress website.Update Query In WordPress
  7. Type the following SQL statement here:UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, '','');UPDATE wp_posts SET post_content = replace(post_content, '', ''); UPDATE wp_postmeta SET meta_value = replace(meta_value,'','');Update Query In WordPressUpdate Query In WordPress
  8. 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.
  9. 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.

Conclusion :-

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.

Author Image About Dikshita

Passionate Electronics and Communication Engineering student with expertise in web development (HTML, CSS, JS,PHP, Bootstrap, React.js) and content writing. Eager problem solver and tech enthusiast, adept at creating engaging web experiences.

Follow Dikshita On Linkedin 🡪