Using code snippets in WordPress

The easiest way to add custom code snippets to your WordPress website is by combing them all into a custom plugin.

A custom plugin can be created by adding a new file in the plugins directory “/wp-content/plugins” called “importwp-custom.php”, and add the following code to the top of that file.


 * Plugin Name: Import WP - Custom code
 * Plugin URI:
 * Description: 
 * Version: 1.0.0 
 * Network: True

 // TODO: Add your custom code here

With the plugin header added to your file, a new plugin should then be visible when browsing the installed plugins page in your WordPress admin area named “Import WP – Custom code”, where it can be activated.

Now you can append any custom code snippets this file after the previously added plugin header code.