Creating a plugin for custom code

In many of the guides we ask you to add code to your theme functions.php file, this can mean that when you update your theme the changes are wiped out (unless you are using a Child Theme – we recommend doing so).

Another way to add the custom code to your site is to create a new plugin for it. It might sound complicated but it’s not. Using this method means the code will not be affected by theme updates and another advantage is that you can simply deactivate the plugin to stop the code being run. Create an empty text file and call it quform-custom-code.php and add this code inside the file:

1
2
3
4
5
6
7
8
9
10
<?php
 
/*
 * Plugin Name: Quform Custom Code
 * Description: Custom code for Quform.
 * Version: 1.0
 */
 
// Paste in your custom code below
 
<?php

/*
 * Plugin Name: Quform Custom Code
 * Description: Custom code for Quform.
 * Version: 1.0
 */

// Paste in your custom code below
 

On line 10 paste in the code from the guide you were following. Then upload this file to your server into the wp-content/plugins folder. Then to go the Plugins page within WordPress and activate the plugin Quform Custom Code. That's it!

Still having trouble? Head over to the forums.

Forums