Understanding how WordPress installs plugins is a great piece of knowledge: 1) it’s actually fairly simple, and 2) it can get you out of a lot of problems. In this article, we’re going to learn about that, and see what we can do with it.
Of course, you should try all the tips and tricks mentioned below on a test site, rather than any website that provides your household income!
Where plugins live
WordPress stores all of its plugins in a particular folder in your website. By default, it is wp-content/plugins. If you use FTP (or cPanel file manager, or whatever), to go there, then you should see one folder for each plugin.
You can probably recognise most of the plugins from the folder names – they are related (but do not have to be exactly equal).
Plugin installation = unzipping: nothing more, nothing less
What happens when WordPress installs a plugin? Actually, not very much: it takes the plugin’s zip file, and unzips it into wp-content/plugins. That’s all.
In other words, you can do the same thing by hand. 1) Get a plugin zip (e.g. find one from http://wordpress.org/plugins/ – find the ‘Download’ link) and download it to your PC/Mac 2) Unzip it (N.B. some computers, especially Macs, do this automatically when you download). 3) Upload the resulting folder into wp-content/plugins. Then, when you visit the WordPress “plugins” page, you should see the plugin listed, ready to be activated.
Deleting plugins = removing files: but be aware of activation issues
This being so, you can also delete a plugin simply by deleting the corresponding folder in wp-content/plugins. But note… if the plugin was active, then the front-end of your site will disappear (i.e. the “white screen of death”) – because WordPress expects active plugins to exist. WordPress has its own list (in its database) of which plugins are active. It’s only safe to delete an inactive plugin, if you don’t mind your site going down.You can bring the site back up by bringing the files back.
Bringing the files back isn’t the only thing you can do. WordPress has tricks up its sleeve. The back-end of your site (i.e. WordPress dashboard) will still load – the dashboard is coded to be ready for missing plugins. The dashboard will simply skip any plugins that are missing. And when you visit the “Plugins” page in your dashboard, WordPress will then de-activate the missing plugin – bringing the front-end of your site back to life.
Using this knowledge when your site breaks
With this knowledge, you are now ready to do several trouble-shooting tasks.
Firstly, we’ve probably all experienced a new plugin update completely breaking your site. Perhaps it wasn’t tested on the version of WP or PHP you’re using – or perhaps it has a conflict with another plugin you have, and nobody’s yet reported this to the plugin author.
Well, what has happened when WordPress updates a plugin? Nothing very clever: it downloaded the new zip file, removed the previous directory from wp-content/plugins, and unzipped the new zip file into there. You can reverse these steps by hand. i.e. Get the zip of the old plugin (e.g. from the “Developers” tab on the plugin’s page at http://wordpress.org/plugins, if it was a plugin from the WordPress.Org directory), unzip it, remove the existing directory from wp-content/plugins, and add your newly-unzipped one.
Or, you can simply rename the plugin’s directory (so that WordPress can no longer find it – e.g. rename wp-content/plugins/myplugin to wp-content/plugins/myplugin-disabled), and then log in to the WordPress dashboard and visit the “Plugins” page – WordPress will then de-activate the problematic plugin. (It will not re-activate it after you rename the directory back – which you will need to do if you want WordPress to match the plugin with the right plugin from its plugin repository).
What have we learned in this short article? We’ve learned that in WordPress, plugins each have their own directory in wp-content/plugins (by default). When WordPress is manipulating (i.e. installing, updating or removing) a plugin, all it’s doing is adding, changing or deleting a directory from there. The only other thing involved is the list that WP keeps in its database of which of those plugins is considered “active”. This means that you can do the same things that the WordPress dashboard does, by moving the files around yourself. This knowledge is sometimes useful when your site breaks, and can help you fix simple issues without needing to look for outside support, or to wait for it to arrive.
David Anderson (founder, lead developer, UpdraftPlus)
The post Understanding how WordPress installs plugins appeared first on UpdraftPlus. UpdraftPlus – Backup, restore and migration plugin for WordPress.