What is a WordPress plugin?
A WordPress plugin is a PHP script that extends or alters the core functionality of a WordPress installation.
In essence, it can just be a single PHP file or a group of files inside a folder.
WordPress offers many different APIs for use by a plugin. Each API (Application Programming Interface), helps the plugin interact with WordPress in a different way.
Advantages of using plugins in WordPress
- Not modifying the WordPress core
- The biggest advantage of using plugins in WordPress is the ability to modify the behavior and functionality of WordPress without modifying any core WordPress files. Core files refer to files that are part of the default WordPress installation.
- One of the reasons why it is not a wise decision to modify WordPress core files is that it becomes difficult to update WordPress when a new version is released. If you made any modifications to any core file, that modification would be overwritten when the update occurs. It is very important to always keep your WordPress up to date with the latest version in order to keep your web site secure.
- Modifying WordPress core files can also make your site unstable, because if the modified part no longer works as expected it can quite possibly break the whole WordPress installation.
Where are plugins stored in a WordPress installation?
WordPress plugins in plugins in two plugin different directories. There is the primary plugin directory, wp-content/plugins and the lesser known wp-content/mu-plugins directory.
The mu-plugins directory, mu stands for Must-Use, is not auto-created by WordPress and so it must be manually created to be used.
The main difference between the two is the mu-plugins directory is for plugins that are always executed and will automatically be
loaded in WordPress and even across all sites in the network if you run Multi-site.
The mu-plugins directory will not read plugins in a subfolder, Any plugin files in a subfolder will be ignored unless included in the primary plugin file.
Types and Statuses of Plugins
The following are different types and statuses for plugins, in WordPress:
Active — an active plugin is a plugin that is activated active and running in WordPress.
Inactive — an inactive plugin is a plugin is installed but has not been activated. No code from the plugin is executed.
Must-Use — Must-Use plugins are plugins installed in the wp-content/mu-plugins directory. All MU plugins are loaded automatically and the only way to deactivate any of them is to remove it completely from the directory.
Drop-ins — Drop-in plugins are created to replace the core functionality of WordPress. They are specifically named PHP files located in the wp-content directory. WordPress detects them, auto-load them and listed them under the Drop-in filter on the Plugin screen.
Your plugin name should be unique to your plugin and should also be descriptive of your plugin’s purpose.
It’s highly recommended to store all your plugin files inside a folder within the plugins directory in WordPress.