• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Basics » Create a plugin file for custom functions

Create a plugin file for custom functions

Chad Butler · May 19, 2016 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

Often it is recommended to put custom functions into your theme’s functions.php file; and while that can work quite well, what if you change themes?  Or what if you are on a multi-site installation and have a number of custom functions you want to use across sites that use different themes?

This article will discuss how to create a custom function file and load it as a plugin.  This way your custom functions stay intact no matter what you do with your theme.  

Creating the file

Start by creating a new php file.  You can call it whatever you want but make it mean something to you, such as my-functions.php.  In this new file, add the following:

<?php
/**
 * Plugin Name: My Functions
 * Plugin URI: http://yoursite.com
 * Description: Custom functions that I use.
 * Author: Your Name Here
 * Author URI: http://yoursite.com
 * Version: 1.0
 */

// Put your code snippets below this line.

Install your plugin file

Once you’ve created and saved your file, load it to your site.  It should be saved in your /wp-content/plugins/ folder.  You could also create a folder specifically for this file such as /wp-content/plugins/my-custom-functions/

When you’ve loaded the file to your site, you can now go to the plugin screen in WP and activate it like any other plugin.

Editing your file

While care should be taken to be editing functions on a live site, if you need to make a change or drop something in, you can still edit this file through WP like you would your theme’s functions.php. This can be done by going to Plugins > Editor and selecting your custom plugin file from the dropdown list of plugins.

Keep in mind, use caution when making an edit on a live site. If you don’t know what you are doing, it’s best to make changes locally and transfer your file via FTP so that you can back out of any change that you make in case you made a mistake.

Alternative Option

There is now a “Site Specific Plugin” framework available that you can use to establish a plugin specific to your site.  The framework is simple to use and all you need to do is install it and add your custom code.  It also includes loading custom CSS and JS.  More info here.

Basics

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy