In this article we will show you the solution of insert query in WordPress, the admin account of a user was once deleted from the database after his site was hacked.
As a result, they couldn't access their WordPress website or account.
So that they could access their website, we made a new admin user right on the WordPress website.
With phpMyAdmin, we managed MySQL databases from a web browser, a web-based tool for managing MySQL databases.
WordPress offers a second method for entering data into the database. This is not how the INSERT INTO statement is often used.
WordPress's default syntax for inserting data is<?php $wpdb->insert($table_name, $data);?>.
The database table name to put data into is contained in the string $table_name. The array $data, on the other hand, is what will be put into the database table.
Step By Step Guide On Insert Query In WordPress :-
- WordPress hosting companies usually come pre-installed with PHPMyAdmin. cPanel's Databases section can be found on the hosting account's cPanel dashboard.
- You can get to the phpMyAdmin interface by clicking the icon. From the left column, select the WordPress database that you want to use.
- After that, phpMyAdmin will show a list of all WordPress tables. In this step, you will make changes to two tables: wp users and wp user meta.
- The wp_users table can be updated by adding a new user
- The wp users table must be selected first by navigating to it and clicking it. You will be able to see the current list of users in the table by clicking on this link.
- As you can see in the screenshot below, our demo website's table contains two user IDs, 1 and 2. Our demo site will have user ID 3 when a new user is created.
- Inserting a new admin user requires you to click the 'Insert' tab at the top of the screen.
- Fill in the following information on the Insert form.
- The ID must be a distinct number; we'll use 3 in this instance.
- Login username: the username with which you will log in.
- The user_pass parameter must contain a password, and the MD5 algorithm must be selected in the function menu.
- To save the new user, click the 'Go' button once you are finished.
As a result, we have successfully learned how to insert query in wordpress.
You can also do this if you've forgotten your password or have been locked out of the WordPress admin area as a result of hackers. Login username: the username with which you will log in.
I hope this article on insert query in WordPress helps you and the steps and method mentioned above are easy to follow and implement.