Are you looking to enable or activate plugins from the WordPress database?
If you are unable to access your WordPress admin area and need to activate a plugin to restore your access, then you can do that from the WordPress database.
In this article, we will show you how to easily activate your WordPress plugins using the database.
When Should You Activate WordPress Plugins Using Database
A number of common WordPress errors can prevent a website owner from accessing the WordPress admin area. In most of those situations, the user is looking to deactivate WordPress plugins without admin access.
However in some situations, a website owner may need to activate certain plugins to restore access to their WordPress website.
For example, let’s assume an error is stopping you from accessing your WordPress dashboard, and you have found a plugin that can fix that error.
Luckily, WordPress stores the active plugins information in your WordPress database. This means you can manually enter this information directly in the database and tell WordPress to activate a plugin.
The only condition is that the plugin must be installed on your WordPress site. Which means that it should be present in the plugins folder on your WordPress website.
With that being said, let’s see how you can easily enable/activate a plugin using the database.
Step 1. Find Your Database Name Using the Hosting Control Panel
To activate your WordPress plugins using phpMyAdmin, first, you need to find out your WordPress database’s name.
Now, to find the name of your database, you need to log in to your web hosting dashboard. For this tutorial, we will be using Bluehost.
If you are using a different hosting company, then your WordPress hosting dashboard may look slightly different.
Once you are on the cPanel, scroll down to the ‘Files’ section and click the ‘File Manager’ option.
This will open up the File Manager in a new window. Here you simply need to locate and click the public_html
folder from the left column.
This will open up all the files that are stored in the public_html
folder. Now, you simply need to locate and click the folder with your site’s name on it present under the ‘Name’ column.
Some users may instead see their WordPress files and folders installed inside public_html folder.
After you have opened up your WordPress site’s file, locate the wp-config.php file under the ‘Name’ section and right-click on it.
This will open up a menu where you need to select the ‘View’ option.
This will open up the wp-config.php
file in a new window where you can locate your database details.
We recommend that you copy and paste your database details including username and password into a notepad on your computer.
Now you’ve successfully found your database’s name, let’s move to our next step.
Step 2. Locate Active Plugins Option via PhpMyAdmin
After you have found out the name of your database, you need to go back to your WordPress hosting control panel.
Once there, scroll down to the ‘Databases’ section and click the ‘phpMyAdmin’ option.
This will launch the phpMyAdmin app in a new browser tab.
Note: Before you make any kind of changes, please make sure to create a complete backup of your database. It will come in handy if anything goes wrong with the process.
Next, you simply need to click the ‘Database’ tab from the navigation menu present at the top of the page.
Now, simply locate your WordPress database and click on the browse button to expand it.
This will show your WordPress database tables.
Here, you will simply need to locate wp_options
table and click browse next to it.
Note: By default, WordPress uses wp_ as the prefix for table names. Your WordPress database table may have a different table prefix.
Inside the wp_options
table, you’ll need to find the row where option_name is set toactive_plugins
.
After that, click on the Edit link next to it.
This will open up a box where you can manually enter details to activate a plugin.
Step 3. Activate a Plugin Using phpMyAdmin
WordPress stores the active plugins information in a special format so that it can be programatically accessed by the software.
In order to tell WordPress which plugins to activate, we’ll need to use that same format.
First, we’ll start by entering the option_value
as a:1:
and then open up the curly bracket ({).
We are entering this value as 1 because we only want to activate one plugin. You have to change the value to the number of plugins you plan on activating.
Next, we will be entering i:0;
after the curly bracket. Here we are essentially assigning a serial number to our plugin.
Remember to always assign numbers starting from 0 instead of 1.
Next, we will be entering the number of characters present in the plugin’s name and the php file name of the plugin that we’re about to activate.
For that, we will type s:24:
in the box. Keep in mind that the number of characters will differ for each plugin based on the characters in the plugin directory and file name.
For instance, we are activating WPForms in this tutorial which has 24 characters in its name including the file name of the plugin as stored in our file manager.
Next, you just need to type the plugin’s directory name. You can find it by visiting the /wp-content/plugins/ folder using the File Manager app.
Don’t forget to add quotation marks before typing the plugin’s directory name.
After the /, you need to enter the plugin’s file name. This is usually the file with similar name inside the plugin folder.
Now, go back to phpMyAdmin and type the name of the plugin and then close the quotation marks.
After that, simply add a semi-colon (;) and close the curly brackets (}). The final value in this example would look like this:
a:1:{i:0;s:24:"wpforms-lite/wpforms.php";}
This is how it will look once you’re done.
Next, simply click the ‘Go’ button to execute the command.
Now go visit your WordPress dashboard and head over to Plugins » Installed Plugins.
Your plugin has been successfully activated.
Now let’s say you want to activate two more plugins.
First you will need to change the number of plugins. After you will adjust each entry for the plugin that you want to activate.
Here is an example:
a:3:{
i:0;s:47:"all-in-one-seo-pack-pro/all_in_one_seo_pack.php";
i:1;s:35:"insert-headers-and-footers/ihaf.php";
i:2;s:24:"wpforms-lite/wpforms.php";
}
Note: We have added line breaks here to make the code look more readable. You need to make sure that there are no line breaks or spaces in your code. Otherwise, it wouldn’t work.
We hope you learned how to activate a plugin using the database. You may also want to see our guide on how to add social media feeds to WordPress, and our comparison of the best domain registrars in the world.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
The post How to Enable / Activate WordPress Plugins from the Database first appeared on WPBeginner.
No comments:
Post a Comment