How To Create a Site Specific Plugin for your WordPress Site

Almost every WordPress user out there will face a situation where they should add a chunk of code into the functional files to add, increase or modify certain features of their WordPres site. The general approach to this is to place the block of code directly into the theme’s functions.php file.

While there is nothing wrong with this approach, it doesn’t make any sense to add all that functionality into a theme file while it is not related to your theme in the first place.

Moreover, adding all the code snippets in your theme’s functions.php file makes it hard to manage and a single mistake may break your site. But with a site specific plugin, you can avoid all that hassle. So in this quick tip, let us see how to create the site-specific plugin so that you can add all the code found on the web that is not related to your theme into that plugin.

Benefits of Site-Specific Plugin

  • The code that you add via site-specific plugin works even if you change your theme in future.
  • Even if there is some error in the code, your site doesn’t break (most of the time). Moreover, you can simply disable the plugin if needed.
  • The code added to the site-specific plugin is easier to maintain.

What Kind of Code Should I Add to Site Specific Plugin?

When I say code snippets that are not related to your theme, I am taking about the functionalities you add that doesn’t depend on your theme. Some examples would be.

  • Adding a code snippet to redirect users.
  • Adding confirmation boxes.
  • Custom post types.
  • To insert ads between posts.
  • Code that customizes specific parts of your WordPress site regardless of the theme you are using (like the comments section).
  • Anything that is not related to your theme.

Create Site-Specific Plugin

Creating a site specific plugin is a lot easier than you think.

1. First off, just create a new text file and name it yourdomainname-plugin.php.

2. Now, open the text file using your favorite text editor and add the below code. Also, don’t forget to change the text.

Plugin Name: Site Specific Plugin for
Description: Add Site Specific Code Snippets to
Author: <a href="">Bloggersignal</a>

/* Add code snippets below this line */

/* End adding code snippets */

3. Once you have done that, simply save it and close the file. If you have problems creating the file, download the sample site specific plugin by Bloggersignal.

4. Now fire up your favorite FTP client and navigate to /wp-content/plugins/ directory. Here create a new folder named “YourDomainName-plugin.”

Create Site-Specific Plugin - Create New Folder in Plugins Folder
Create Site-Specific Plugin – Create New Folder in Plugins Folder

5. After creating the folder, navigate to it and upload the file yourdomainname-plugin.php into it.

Create Site-Specific Plugin - Upload File
Create Site-Specific Plugin – Upload File

6. Once you have uploaded the file, open up your WordPress admin panel and activate the plugin.

Create Site-Specific Plugin - Activate Site-Specific Plugin
Create Site-Specific Plugin – Activate Site-Specific Plugin

That’s all there is to do. From this point forward, you can add any code snippets you found on the web directly to the site-specific plugin rather than the theme functions.php file.

Hopefully that helps and do comment below if you face any problems or to share your thoughts and experiences about using the site-specific plugin.


    1. Hello Irene,

      Sorry for not being specific. When I say “create a file,” I mean to “create a new text file.” I’ve also updated the article accordingly.

      Thanks for pointing that out. Hope to see you around.

  1. I have followed all the steps and see the file in the correct directory via FTP. However, the plugin does not appear in WordPress, even after logging off and back on.

    1. Make sure that you’ve added the file in its own folder, the file path should be something like /wp-content/plugins/yourdomain-plugin/yourdomainname-plugin.php. Also, make sure that you have proper file extension. i.e, .php.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.