Often you can add personalized snippets of code to the functions.php file of your theme or in a site-specific plugin while reading WordPress tutorials. The problem is, that your website can be broken by even a minor error. We will show you in this Article an easy way to add custom code without breaking your website in WordPress.
The Custom Snippets Problem
In WordPress tutorials you often find snippets of code with instructions to put them in the functions.php file of your theme or a website-specific plugin. The problem is that your WordPress site can also be broken and made inaccessible even by a minor failure in your custom code snippet.
Secondly, you can make it difficult to manage the file if you add several codes snippets to a site-specific plug-in. We recently found an easy way for users to add and manage tailored code snippets in WordPress when they were looking for a solution.
Adding WordPress Custom Code Snippets
First, the Code Snippets plugin on your site must be installed and enabled. See our step-by-step guide on installing a WordPress plugin for more information. Only a new menu item called Snippet will be added to your WordPress Admin bar after activation.
If you click on it, a list of all the custom code snippets you saved on your website will appear. Your list will be empty as you have just installed the plugin. To add your first custom code in WordPress, go ahead and press the Add New button.
You can now access “Add New Snippet” on this page.
You must first enter a title for your custom snippet code. This could help you to identify the code. You can then copy your snippet code to the code box and paste it into.
We added a custom code snippet in the screenshot above to remove our test siten version number from WordPress.