How to Create a WordPress Functionality Plugin

Creating a functionality plugin is one of the safest ways to add custom PHP code to your WordPress website. Unlike adding code to your theme, a functionality plugin remains active even if you switch themes or update your current one.

A functionality plugin is simply a small WordPress plugin containing your custom code. Because it can be activated or deactivated whenever needed, it is ideal for temporary workarounds, WPML fixes, custom snippets and other site-specific functionality.

Create the plugin

Create a new folder inside /wp-content/plugins/; usually this is done via (S)FTP. I recommend including (your) initials to make the plugin name unique. As an example: xy-functionality-plugin.

Inside that folder, create a file with the same name: xy-functionality-plugin.php.

Add the following header to this file:


<?php
/**
 * Plugin Name: XY Functionality Plugin
 * Description: Custom functionality and temporary workarounds.
 * Version: 1.0.0
 * Author: XY
 */

Adding and managing code

Below that header, you can paste any custom code, filter(s), or workaround(s). I would suggest to also include a comments block, especially if you are adding more than one snippet to your functionality plugin.

Save the file and activate the plugin under Plugins in the WordPress admin.

If a bug is officially fixed in a future (WPML) update, you can simply open this file and remove the specific snippet, or deactivate the entire plugin if it was only for that single issue.

This method keeps your website architecture clean, prevents your custom changes from being wiped out during a theme update, and keeps your custom PHP code separate from your theme, making it much easier to manage.

And if coding is not your thing, then I recommend the Code Snippets plugin for which I created a separate article with tips.

Photo by Shahadat Rahman on Unsplash