Do you want to add or create a WordPress Plugin website specific? Or would you like to install a WordPress Plugin code snippets?

A website-specific plugin lets you easily add snippets to your WordPress site without relying on your theme.

In this article we will explain how to create a WordPress Plugin specific to the website and why it is important.

But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

What is a Website Specific WordPress Plugin

A website-specific WordPress plugin is a standalone plugin that you can use to add any customization snippets that aren't theme dependent.

When working on your website, you will often find WordPress tutorials asking you to add code to your file functions.php or a website-specific WordPress plugin.

WordPress does not come with a website-specific WordPress plugin. You will need to create your own, then install and activate it.

Why create a website-specific WordPress plugin?

As we mentioned earlier, you'll often come across tutorials showing code you can add to your file. functions.php or a website-specific WordPress plugin.

These custom codes can be used to add new post types, taxonomies, shortcodes and tons of hacks to improve your website.

If you add the custom code to the file functions of your theme, it will disappear if you update or change WordPress theme. You can create a child theme or use child theme's functions file to save your code. However, your code will still disappear if you change themes.

A website-specific WordPress plugin allows you to easily add custom snippets to your website and ensure they are theme-agnostic. It is a standalone WordPress plugin, which means it does not depend on your theme and you are free to update or change themes.

That being said, let's see how to easily add custom code using a website-specific WordPress plugin. We'll show you two ways to do this, and you can choose whichever method works best for you.

Method 1. Manually create a website-specific WordPress plugin

We know this might sound a bit geeky for beginners, but we'll try to make it as easy as possible for you.

First you need to create a new folder on your desktop and name it after your website, for example, my-website-plugin.

create a site-specific WordPress plugin

Now open a plain text editor on your computer like Notepad, Visual Studio Code or TextEdit. You need to create a new file and save it as my-website-plugin.php in your desktop's plugin folder.

create a site-specific WordPress plugin

Your plugin file needs a specific header code for WordPress to recognize it as a plugin. Go ahead and add the following code to your my-website-plugin.php file:

<?php
/*
Nom du plugin : Plugin site pour exemple.com
Description: Modification spécifique du Code du site exemple.com
*/
/* Commencez à ajouter les fonctions en dessous de cette ligne */
  
  
/* Arrêter d'ajouter des fonctions au dessus de cette ligne */
?>

You can replace example.com with your own domain name. Once you've done that, your website-specific plugin is ready.

There are two ways to upload your site-specific plugin to your website. You can either upload it through your WordPress admin panel or use FTP.

1. Install the website specific plugin from the WordPress admin area

This method is easier and recommended for all users.

First, you need to create the zip file of your website-specific plugin folder.

Windows users can simply right-click on the plugin folder and select Send to -> Compressed folder (zip).

or on Windows 11

compress a file in windows

Once you have the plugin zip file, go to the page Extensions -> Add from your WordPress admin area and click the " Upload an extension " up.

create a site-specific WordPress plugin

Then click on the button Choose File to select the zip file you created earlier, then click the “ install now ».

WordPress will now download and install the plugin for you. Once it is downloaded, you need to click on the button Enable to start using your website-specific plugin.

install a WordPress plugin

2. Upload your site-specific WordPress plugin via FTP

For this method, you don't need to create a zip file. You go download the plugin via FTP.

First, you need to login to your website using a FTP client.

Once logged in, navigate to the folder /wp-content/plugins/ under the remote website column. Next, you need to select your site-specific plugin folder and upload it to your website.

Your FTP client will transfer your site-specific plugin folder to your WordPress website. This will install the plugin on your website.

However, you will still need to activate the plugin to start using it. You can do this by going to the " Extensionsin your WordPress admin area, then clicking on the link " Enable under your site-specific plugin.

Enable a plugin

That's all. Your site-specific plugin is now ready to use.

Adding custom code snippets to your website-specific plugin

There are two ways to edit your plugin and add custom code snippets to it.

The first method is to do it through the WordPress admin area. You can go to Extensions -> Extension File Editor. You will see a warning message and you need to click on the " I understand " to continue.

Next, you need to select your site-specific plugin from the drop-down menu labeled “ Select the extension to edit ". The editor will load your plugin file and you can add code snippets to it.

WordPress plugin editor

Once you are done, click on the button Update file To save your changes.

If something is missing in your code or has the potential to break your website, the plugin editor will automatically revert your changes.

However, if the editor fails and you see the white screen of death, you can use FTP to edit your extension file and undo those changes.

The second method is to directly edit the plugin file using FTP. Simply go to the plugin folder using your FTP client. Right-click on the plugin file, then select View/Edit File.

edit file via FTP client

You can also download the plugin file to your computer, edit it, and then upload it again.

Method 2. Using Code Snippets Plugin

This method is much simpler and gives you a better way to manage your snippets in WordPress.

The first thing you need to do is to install and activate the plugin Code Snippets on your website. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, the plugin will add a new menu item titled " snippets to your WordPress admin menu. This is where you will manage all of your custom codes.

To add a custom code, you must go to the page Snippets » All Snippets and click on the button 'Add' at the top.

use a WordPress snippets plugin

This will take you to the page " Add an excerpt ».

First enter a title for your custom snippet. It can be anything that helps you identify the code.

After that, you can go ahead and paste your code snippet into the code box.

use a WordPress snippets plugin

You can also add a code description in the field below the code box. You should use this area to write what this code does, where you found it, and why you are adding it to your website. This will help the "future you" remember why the "once" you added this code.

You also have the option to assign tags or labels to your snippets, which can help you organize snippets by topic and feature.

Finally, you can click on the button Save changes and activate ". If you just want to save the code snippet without activating it, you can click the button Save Changes in place.

The plugin also lets you select where you want to run the snippet. You can choose from admin area options, frontend or everywhere.

If you are unsure, keep the default "everywhere" option checked.

Once you register and activate a code snippet, it will become effective on your website.

Other recommended resources

We also invite you to consult the resources below to go further in the grip and control of your website and blog.

Conclusion

There ! That's it for this tutorial. We hope this article helped you learn why and how to create a website-specific WordPress plugin.

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

But, in the meantime, don't forget to leave us your Comments and suggestions in the dedicated section.

...