How to Create a Site Specific Plugin for your WordPress Site

How to Create a Site Specific Plugin for your WordPress Site

Today we will learn how to create a site specific plugin for our WordPress site. Before we get started on creating the file, lets briefly talk about why these plugins are helpful.

In the past, if you wanted to add a code snippet to your site then you might use your theme’s functions.php file which is usually in this location:

wp-content/themes/yourthemefolder/functions.php

One problem with this approach is that it does not account for theme updates which means there is a risk of losing your customizations if you update your theme. This is especially true if your theme has a convenient one-click update feature from within the WordPress admin. A site specific plugin is a better choice since your customizations will be in organized in one location. Additionally, if you add your code through the WordPress Plugin Editor, then WordPress will check your code to ensure that it won’t cause any fatal errors and take your site offline. Finally, some customizations require loading the code early in the request, so by the time the theme’s functions.php file loads it’s too late!

The Solution: Create your Site Specific Plugin

To get started, you will need to login to your WordPress root with an SFTP or FTP client. Cyberduck and FileZilla are free options that are available on multiple platforms. This will require an SFTP or FTP login which can be provided by your web host.

1) After logging in to your WordPress root, browse to this location:

wp-content/plugins

2) Now create a new folder. In this example, we’ll create one called myexamplesite:

3) Next, open the new folder that you just created.

4) We now need to create a file. In this example, we will create a file called myexamplesite-customizations.php: