WordPress

Plugin

A plugin is a set of PHP files that hooks into the WordPress core through actions and filters to add features to a website without modifying the original code.

In this post

A plugin is an extension that is installed in WordPress to give it new features. The word means something that plugs in. It works like an add-on that connects to the website. With a plugin you can add a contact form, an online shop, a booking system or a security tool.

The great advantage is that you do not need to write code. A plugin is installed from the dashboard in a few clicks and then activated. That is a big part of why WordPress has grown so much. Anyone can build a website with advanced features by combining plugins. The downside is that every plugin is someone else’s code running inside your website.

A plugin is an added piece that gives your website a new capability. It is very useful, but every piece you add is also one more door that has to be watched.

What is a WordPress plugin?

WordPress has been designed to be extended with plugins since version 1.2, released in 2004. Its main program handles the basics, which is managing content and users. Everything else is added through extensions. That architecture lets the same system power a blog, an online shop, a booking website or a membership community. The official directory holds tens of thousands of free plugins, and outside it there are many more premium ones. Some are huge and built by large companies, like the ones that run complete online shops. Others are small and maintained by a single person. That variety is a real strength, but it also explains why quality is so uneven.

How core, plugins and theme combine on different websites

There are also developer plugins that are not visible on the website but help with the work behind it. They are used to debug errors, measure performance or move a website from one server to another. They are less well known, but very valuable for anyone who maintains several projects.

How a WordPress plugin works under the hood

At a minimum, a plugin is a PHP file with an opening comment that states its name, its author and its version, stored in the wp-content/plugins folder. Once it is activated, WordPress loads it on every request, together with the rest of the active plugins, before loading the theme.

The way a plugin steps in is through hooks. WordPress sends out signals at many points while it runs, for example when a post is saved or when content is displayed, and plugins attach themselves to those signals. Actions, registered with add_action, let a plugin run something at a specific moment, and filters, registered with add_filter, let it modify a piece of data before it is used.

How a plugin hooks into WordPress core with a hook

This way a plugin can add features without touching a single line of the core, and WordPress updates do not wipe out its work. There are also two special families, must-use plugins, which always load and cannot be deactivated from the dashboard, and drop-ins, files with fixed names that replace specific parts of the core.

What plugins are used for

Plugins give a small business the same tools as a large one. An online shop that a few years ago would have cost thousands of euros in development can be built today with a handful of plugins. That democratisation is one of the reasons for the success of WordPress, and for the huge number of websites built with it. A freelancer today can run a shop with payments, shipping and invoices without hiring a team of developers. But there is also a dark side. It is easy to pile up plugins without thinking. They get installed to try something out, are left active and are forgotten. Over the years, a website can end up with dozens of extensions, many of them unused, others abandoned by their developers and several with known flaws waiting to be exploited.

The difference between a plugin and a theme

A WordPress plugin and a theme are often confused with each other. The theme decides how the website looks, with its design, its colours and its structure. The plugin decides what the website can do, with features such as a form, a shop or a backup. The separation is deliberate. If a business changes its theme, its features should still be there. If it changes a plugin, the design should stay the same. In practice, some themes include their own features and some plugins alter the appearance. When important features live in the theme, switching themes makes them disappear. A useful rule is that everything the business needs to keep, such as content types or forms, should live in a plugin and not in the theme.

Difference in how a WordPress theme and plugins work

Types of plugins by function

The types of WordPress plugins are grouped by the job they do, and that variety explains why two websites with the same theme can be so different. It is also a warning, because the more features you cover with plugins, the more pieces you have to maintain.

Security plugins

Security plugins monitor logins and the files on the website. They limit login attempts, add a second factor, block suspicious requests with a web application firewall and compare core files with the official ones to detect changes.

Backup plugins

Backup plugins save the database and the files on a schedule and send them to external storage. What matters is not only that they copy, but that they allow a fast restore and that the backup does not stay on the same server as the website.

Performance and caching plugins

Performance plugins generate static copies of pages, compress and combine files, defer the loading of images and scripts and connect the website to an object cache. Well configured, they cut loading times dramatically, and badly configured they can break forms or shopping carts.

Search engine optimisation plugins

SEO plugins let you edit the title and description of each page, generate the sitemap, add the structured data that search engines read and manage redirects when an address changes.

Form and ecommerce plugins

Form plugins create contact, quote or registration forms without coding, and ecommerce plugins, such as WooCommerce, turn the website into a shop with a catalogue, a cart, payments and order management. They are the ones that handle the most personal data and the ones that demand the most care.

Page builder, integration and compliance plugins

There are also plugins that add blocks or visual builders, plugins that connect the website to external services such as email, the CRM or invoicing, and plugins that take care of legal requirements, such as cookie banners or privacy texts. Before installing one, it is worth asking whether something already on the website does the job, or whether a configuration change would be enough.

Plugins outside WordPress

The concept of a plugin is common across software. A main program defines a connection point and a set of rules, and other developers build pieces that attach to it without modifying its code. That is how filters in image editing programs work, as well as VST audio instruments and effects, code editor extensions and the modules of other content management systems, such as Drupal or Joomla.

For years browsers had plugins that ran external content, such as Flash, Java or Silverlight, through the NPAPI interface. They were a constant source of security flaws, and browsers phased them out until Flash reached its end of support on 31 December 2020. Today their place has been taken by extensions, which are more limited and reviewed by each browser’s store.

Risks and benefits of using plugins

The real risk of plugins

Security companies that specialise in WordPress publish reports on the vulnerabilities they find every year. Almost all of them reach the same conclusion.

The vast majority of flaws are not in the main WordPress program, but in plugins and themes. The core gets a lot of scrutiny, but third-party extensions do not always get the same.

This risk does not mean that plugins are bad by definition. It means that there are a huge number of them, that they are written by people with very different levels of experience and that some are never reviewed at all. A vulnerability in a popular plugin affects hundreds of thousands of websites at once, which makes it a very profitable target for attackers.

Pros and cons of using plugins

The great advantage is that they let you extend a website without coding. With little time and little money you can add features that would otherwise require custom development. On top of that, a mature plugin has a community that tests it, improves it and finds its bugs. For many small businesses it is the only realistic way to have an online shop, a booking system or good search rankings. The drawbacks are just as clear. Every plugin is someone else’s code running on the website, and its quality varies a lot. It can slow pages down, clash with others, be abandoned or contain security flaws. By relying on a specific plugin, the website becomes exposed to someone else’s decisions, such as raising the price, stopping maintenance or being bought by another company. That is why it pays to choose carefully and to review from time to time what is actually being used.

How to choose and maintain plugins

Choosing plugins with good judgement

Before installing a plugin, it is worth checking its page in the official directory. Look at the date of the last update, the number of active installations, the ratings and the compatibility with the current version of WordPress. A plugin that has not been updated in two years is a bad sign.

It also matters a great deal who is behind each plugin. Plugins from well-known companies, with support teams and a track record of responding to flaws, tend to be safer. It is not a guarantee, because even the big names have had incidents, but the ability to react quickly is an important advantage over a project run by a single author.

There is also a simple rule for choosing plugins with good judgement. Less is more. Every plugin adds code, queries and potential bugs. If a plugin does three things and you only need one, there may be a lighter alternative. Keeping the list short, reviewing it every few months and removing what is not needed is the best way to have a fast and secure website.

How a plugin is installed, updated and deactivated

A WordPress plugin can be installed in three ways. From the search box in the dashboard, which downloads plugins from the official directory, by uploading a ZIP file, the usual route for premium plugins, or by copying its folder to the server. Once activated, the plugin appears in the list and may have its own settings screen. If a blank screen or a critical error appears after a change, you can recover WordPress without losing data.

Since August 2020, with WordPress 5.5, every plugin can be updated automatically. Deactivating a plugin stops its code but keeps its settings, and deleting it removes its files, although many leave data in the database if their author did not plan a clean-up on uninstall. If an update causes problems, you can go back to an earlier version, which the official directory keeps available for download.

Maintaining plugins over time

Installing a plugin is only the first step of its maintenance. The most important part comes afterwards. Every so often you need to review the list, check that every plugin is still receiving updates and remove the ones that are no longer used. Many websites get infected through a plugin that someone installed years ago and that nobody remembered having. It is a good idea to test major updates on a copy of the website before applying them to the live version. That way conflicts are detected without affecting visitors. It also pays to always keep a recent backup, stored off the server, so you can go back if something goes wrong after an update. When a conflict appears between plugins, the official Health Check plugin includes a troubleshooting mode that disables them only for the administrator, so the culprit can be found without visitors noticing.

Free, premium and pirated plugins

Free plugins in the official directory go through a basic review and receive updates through WordPress. Premium plugins usually offer support and advanced features, and are updated through a licence. Many follow the freemium model, with a free version in the directory and a paid one with more features. Both options can be safe if the developer keeps the product maintained. What matters is the source and the maintenance.

Pirated plugins are a separate case, and a very dangerous one. They are premium versions handed out for free on unofficial websites. They frequently carry malicious code, such as hidden administrator accounts. Security companies have been warning about this for years. Saving the price of a licence can cost you the entire website. On top of that, using pirated versions is illegal, and plugin companies do track down and take action against the use of fake licences.

If a premium plugin is too expensive for your project, it is better to look for a legitimate alternative, even a simpler one. A well-maintained free plugin is always safer than a pirated one.

A flaw in a file manager plugin exploited on a massive scale

In September 2020, the security company Wordfence warned of a critical flaw in the WP File Manager plugin, which had more than 700,000 installations. The flaw allowed anyone to upload files to the server without logging in, and with that to run code. Attackers were actively exploiting it even before the advisory was published.

The plugin’s authors released a patch the same day they learned of the attacks. Even so, within a few days security companies recorded attack attempts against millions of websites, whether or not they had that plugin installed. Many websites were slow to update, and some ended up infected. It was a demonstration of how fast a flaw is exploited as soon as it becomes public. Attackers automate the search for websites running the plugin and attack them one after another, regardless of whether they are large or small, famous or unknown.

The case of that file manager taught three lessons. First, that a very popular plugin can have a serious flaw. Second, that updating on time is decisive, because attacks start within hours. And third, that plugins you no longer use should be removed, since a forgotten plugin with a flaw is still a way in for an attacker.

Automatic updates, which WordPress had introduced a month earlier, are very useful for trusted plugins, because they shorten the window during which the website is exposed. Even so, it is wise to keep recent backups in case an update breaks something, and to keep an eye on the website after every change.

Frequently asked questions

Frequently asked questions about Plugin

What is a WordPress plugin?

It is a program that is installed inside WordPress to add new features. It can be used to build forms, sell products, improve search rankings or protect the website. It is installed and activated from the dashboard, without writing any code.

How many WordPress plugins are there?

The official WordPress directory contains tens of thousands of free plugins. On top of those come the premium ones, sold on their developers' websites. There is an option for almost any need, although quality and maintenance vary enormously.

Why is a plugin a security risk?

Because it is third-party code running on your website. If it has a flaw, it can give an attacker access. Most of the vulnerabilities published for WordPress are found in plugins rather than in the main program.

How many plugins should I install on WordPress?

As few as possible. There is no magic number, but every plugin adds code, load and potential bugs. The ideal is to install only the ones you need, remove the ones you do not use and favour well-maintained plugins that do several things well.

Is deactivating a plugin enough?

No. A deactivated plugin is still on the server and, if it has a flaw, it can still be attacked. The right thing to do is to delete it completely when it is no longer needed. That also removes any risk tied to its files.

What is an abandoned plugin?

It is a plugin that its developer no longer updates. It receives no security fixes and is not adapted to new versions of WordPress. If you keep using it, you run the risk that a known flaw stays unpatched forever.

What is the difference between a plugin and a theme?

The theme controls how the website looks. The plugin adds features. If a change is about how something looks, it usually belongs to the theme. If it is about what the website can do, such as selling or sending emails, it usually belongs to a plugin.

Do plugins slow down a website?

They can. What slows a site down is not the number of plugins but what each one does. A lightweight plugin is barely noticeable. One that loads many scripts on every page or runs many queries can become a significant speed problem.

I review the plugins on your WordPress site

I can check which plugins you have installed, which ones are unnecessary and which ones pose a real risk to your website.

About the author

Javier Afán

WordPress developer specialised in security, WooCommerce, and hacked website recovery.

I work on WordPress from a technical angle focused on security, architecture, and the decisions that really affect a project's continuity.