Skip to content
The Admin Bar
  • Get Involved
    • Facebook Group
    • Barfly Community
    • TABLE Mastermind
  • Learn
    • Articles
    • Events
    • Newsletter
    • YouTube
    • WordPress Professionals Survey
    • SEO Weekly
    • Security Weekly
    • Accessibility Weekly
  • Products
  • About
  • Free Stuff

A Beginner’s Guide to Functionality Plugins in WordPress

Learn how to turn your custom code snippets into a clean, reusable WordPress functionality plugin that’s safe, organized, and future-proof.

Mark Westguard

Mark Westguard

Published:

September 23, 2025

Filed Under:

Education, Plugins

Mark Westguard

Mark Westguard

WS Form

Mark is the founder of WS Form, a WordPress form plugin at the forefront of innovative form-building solutions. His career, spanning over 25 years, includes running web agencies in both the UK and the USA. Mark is a familiar face at flagship WordCamp events, where he actively participates and sponsors, with a commitment to advancing the WordPress ecosystem.

Wordpress admin plugins plugin activated
This content contains affiliate links. View our affiliate disclaimer.

If you’ve ever copied a code snippet into your theme’s functions.php file or installed a code snippets plugin, you’ve already brushed up against the concept of a functionality plugin.

A functionality plugin is simply a lightweight, custom WordPress plugin you create to store your own snippets of code. It’s the safest and most future-proof way to add customizations to your WordPress site.

Advantages include:

  • Theme independence
    Your code stays active when you switch themes.
  • Organization
    Keeps custom snippets in one place.
  • Performance
    Avoids heavy plugins for small tasks.
  • Portability
    Move your custom plugin between sites.
  • Control
    Own and manage your own code.

Tools You’ll Need

A Code Editor

To write plugins, you’ll need a code editor.

In this tutorial we’ll use Cursor which is free, lightweight, and works on Windows, macOS, and Linux. It provides syntax highlighting, auto-complete, and PHP/WordPress extensions.

A Local Development Environment

Editing code directly on a live site is risky, so we’ll use a local development environment for testing our plugin.

In this tutorial we’ll use WordPress Studio which allows you to spin up a WordPress site locally, test your plugin, and experiment safely before deploying to production.

1. Spinning Up a WordPress Site

First, let’s spin up a local WordPress site using WordPress Studio that we’ll use for developing our plugin.

Image

Choose a name for the site. This will be used for the Site Title setting in WordPress.

We’ll use all the default settings which will create a site that will use the latest version of WordPress and PHP.

So, click Add Site and WordPress Studio will get busy building a local development environment for you.

Once complete you will see an admin panel for the site which allows you to access and edit the code for the website.

Image

In this tutorial we’ll only be concerned with the following buttons:

  • WP Admin
    This opens the WordPress admin in your web browser.
  • Open site
    This opens the frontend of the site in your web browser.
  • Open in … > Cursor
    This opens the root folder containing all of the files associated with the site in Cursor.

2. Open the Plugins Folder in Cursor

To start creating your plugin, we’ll need to open the Plugins folder in Cursor. To do this, first click on Open in > Cursor in WordPress Studio.

Next, navigate to the plugins folder which can be found under:

/wp-content/plugins

Image

Once the Plugins folder is open, we need to create a new folder for our plugin.

Create a folder named my-agency-name (Change this to suit). To do this in Cursor, simply right click on the plugins folder and choose New Folder…

Inside it, create a file called my-agency-name.php by right clicking on the folder you just created and choose New File…. The PHP filename should match the folder name.

Your final file structure should look something like this:

  • wp-content
    • plugins
      • my-agency-name
        • my-agency-name.php

You could drop a PHP file straight into the /wp-content/plugins folder and WordPress would load it, but that’s not good practice. Keeping your plugin inside its own folder makes it easier to manage, avoids file conflicts with other plugins, and gives you room to add more files later (like CSS, JavaScript, or templates) without cluttering the main plugins directory.

Choose a unique name for your plugin folder so it doesn’t potentially clash with other plugins. If two share the same name, WordPress can’t load them properly.

3. Add the Plugin Header

When WordPress loads, it scans the files inside the wp-content/plugins/ directory. It looks at the top of each file for this plugin header comment block. If it finds the required information (at minimum, the Plugin Name), it registers that file as a plugin and lists it in the admin dashboard.

Every WordPress plugin file starts with a plugin header, a special block of PHP comments that tells WordPress important information about your plugin. Without it, WordPress won’t recognize your file as a plugin.

In the code editor let’s add a basic WordPress plugin header. This will always sit at the very top of your main plugin file.

<?php
/**
 * Plugin Name: My Agency Name
 * Plugin URI:  https://yoursite.com/
 * Description: Add great functionality to all client sites.
 * Version:     1.0.0
 * Author:      My Agency Name
 * Author URI:  https://yoursite.com/
 * License:     GPLv2 or later
 */

Let’s break that header down so that you can edit it to your preference:

  • Plugin Name
    This is the only required field. It appears in the WordPress dashboard under Plugins. If you leave it out, WordPress won’t detect your plugin.
  • Plugin URI
    A link to more information about the plugin. For public plugins, this is usually the page on WordPress.org or the developer’s website. For client projects, you could link to a private knowledge base article, your agency’s support page, or documentation.
  • Description
    A short explanation of what your plugin does. This text shows up under the plugin name on the admin plugins page. Use this space to summarize the main purpose of your plugin.
  • Version
    Defines the current version of your plugin (for example, 1.0.0). This is useful for tracking changes, compatibility checks, and updates. Following semantic versioning (major.minor.patch) is a best practice.
  • Author
    The creator of the plugin. It shows up in the admin plugins list and is especially helpful when clients or teams need to know who wrote it. You can also include your agency name here for branding.
  • Author URI
    A link associated with the author. Usually this points to your website, portfolio, or agency homepage. For agencies, this is a great opportunity to display your brand in every client’s dashboard.
  • License
    Specifies under which license your plugin is released. WordPress plugins must use a GPL-compatible license, such as GPL2 or GPL3. This ensures that your plugin follows the same open-source philosophy as WordPress itself.

There are other headers you can add, for example for specifying minimum PHP and WordPress versions, but the above headers will suffice for this tutorial. You can find the full list of supported plugin header fields in the WordPress Plugin Handbook: Header Requirements

4. Prevent Direct Access

Next we’ll add some code to prevent the plugin file being accessed directly.


// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit; 
}

This prevents people from directly executing your plugin’s PHP file outside of the WordPress environment, which is a simple but important security best practice.

ABSPATH is a constant that WordPress defines when it’s running.

If someone tries to load your plugin file directly in the browser, WordPress hasn’t loaded yet so ABSPATH won’t be defined. In that case, the code immediately runs exit;, which stops execution.

5. Test The Plugin

So far your plugin code should look like this:


<?php

/**
 * Plugin Name: My Agency Name
 * Plugin URI:  https://yoursite.com/
 * Description: Add great functionality to all client sites.
 * Version:     1.0.0
 * Author:      My Agency Name
 * Author URI:  https://yoursite.com/
 * License:     GPLv2 or later
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit; 
}

… and Cursor should look something like this:

Image

Your plugin won’t do anything yet, and that’s okay! The important step is that it appears in the plugin list, which means WordPress has recognized your header correctly.

Save the my-agency-name.php file in Cursor and then click WP admin in WordPress Studio. This should take you straight to the WordPress admin without needing to log in.

Click Plugins in the WordPress admin and you should see your plugin listed. Click Activate to activate your plugin.

Image

Congratulations, you’ve built your first functionality plugin! Now let’s make it do something!

6. Adding Functionality

Now that our plugin is activated, let’s add some functionality to it. We’ll start with a simple but useful example: showing a yellow warning banner in the WordPress admin when the setting “Discourage search engines from indexing this site” is enabled in Settings > Reading. This makes it obvious when a site is blocked from indexing, something that’s easy to miss but critical for SEO (Search Engine Optimization) and AEO (Answer Engine Optimization).

Here’s the code:


// Show a warning banner in the admin area if search engines are discouraged
function my_functionality_indexing_warning() {
    if ( get_option( 'blog_public' ) == '0' ) {
        echo '<div class="notice notice-warning">
            <p><strong>Warning:</strong> Search engines are discouraged from indexing this site. 
            <a href="' . esc_url( admin_url( 'options-reading.php' ) ) . '">Update this setting</a>.</p>
        </div>';
    }
}
add_action( 'admin_notices', 'my_functionality_indexing_warning' );

To add this snippet to your plugin:

  1. Open your my-agency-name.php file in Cursor.
  2. Paste this code snippet at the end of the file.
  3. Save the file.

When you refresh your WordPress admin dashboard, if the setting under Settings > Reading > Search Engine Visibility is checked, you’ll see the warning banner appear across the top of every admin screen.

This example demonstrates the workflow you’ll use for every new feature: copy a snippet, paste it into your plugin file, and test it. From here, you can continue adding more snippets to your plugin, such as custom login logos, footer text, or a [year] shortcode.

If you make a mistake and WordPress shows an error, don’t worry, you can make edits in Cursor, save the file and refresh the browser again.

Congratulations, you’ve built your first functionality plugin!

Using AI

AI can help you build a functionality plugin in minutes. In this tutorial, we’ll use Claude Code to generate a plugin from scratch and even add features to the one you created earlier.

Note: AI can generate useful starter code, but always review and test it, don’t paste blindly into production. You should always check code to ensure it is secure and follows WordPress best practices for performance, accessibility, and maintainability before using it on a live site.

1. Get Claude Code

Claude Code is an AI coding assistant from Anthropic. It acts like a coding partner inside editors such as Visual Studio Code, Cursor, and Windsurf, helping you write, edit, and understand code faster.

To use Claude Code, you’ll need a paid Claude account (the Pro plan includes it). After signing up, install Claude Code using the command provided on their website.

Note: Claude Code installs with npm (Node Package Manager), which comes with Node.js. If you don’t already have Node.js, download the LTS (Long-Term Support) version for your operating system at nodejs.org.

2. Open Claude Code in Cursor

Next, we’ll open Claude Code in Cursor. Click Terminal in the top menu, then select New Terminal. A terminal panel will open in Cursor.

Type claude and press Enter. Claude Code will start in the terminal — just follow the prompts to finish setup.

Image

3. Ask Claude Code to Build a Plugin

Now that Claude Code is running, it can work with the folder you have open in Cursor.

Let’s ask it to create a simple functionality plugin. Here’s an example prompt you can use:

Create a simple functionality plugin for WordPress in the plugin folder.

The plugin details are:

Name: My Agency Name
Description: Add great functionality to all client sites.
Author: My Agency Name
URL: https://theadminbar.com

The plugin functionality should be:

1. Show a warning message if "Discourage search engines from indexing this site" is enabled.
2. Set the WordPress admin footer text to say "Built by The Admin Bar".

You can edit this prompt to fit your needs. Copy and paste it into the Claude Code terminal, then press Enter. Claude Code will begin generating your plugin.

Image

4. Test Your Plugin in WordPress

Once the code is ready, test the plugin in WordPress. In WordPress Studio, click WP Admin to open the dashboard. Go to Plugins, activate your new plugin, and check that it works.

You should see the updated footer text. If you enable “Discourage search engines from indexing this site” under Settings > Reading, the warning message should appear.

5. Modify Your Plugin with AI

Claude Code can also help you modify your plugin. For example, let’s add a link to the warning so users can quickly jump to Settings > Reading.

In Cursor, type this into the Claude Code terminal:

Add a link to the warning that goes to Settings > Reading so the user can edit the search engine setting.

Claude Code will update your plugin and add the link. Refresh the WordPress admin to see the change in action.

Congratulations — you just built and customized a functionality plugin using AI!

Creating an Installable Zip File

WordPress plugins are usually installed by uploading a zip file to the Plugins area. It’s not just for sharing, it’s how you move the plugin between sites or give it to a client.

Creating an installable zip file is easy, here’s how.

  1. In your computer’s file explorer, locate the my-agency-name folder that contains your plugin file.
  2. Right click the folder and choose Compress (macOS) or Send to > Compressed (zipped) folder (Windows).
  3. This will create a file named my-agency-name.zip.

To test your zip file:

  1. Login to a different WordPress site.
  2. Go to Plugins > Add New > Upload Plugin.
  3. Click Choose File, select my-agency-name.zip, and click Install Now.
  4. Once uploaded, click Activate to enable the plugin.

Wrapping Up

You’ve built your first functionality plugin! Along the way, you’ve also learned how to:

  • Develop safely with WordPress Studio.
  • Create, activate, and test a custom plugin with Cursor.
  • Use AI to develop code.
  • Package your plugin as a ZIP for use on other sites.

From here, you can continue adding more snippets to your plugin, from disabling the admin bar, to adjusting excerpt lengths, or even creating full-fledged custom features. With this workflow, your customizations will always be organized, portable, and under your control.

Example Snippets

To get you started, here are some different snippets of code you can use in your functionality plugin.

Each of these snippets can be added to the same my-agency-name.php file, below the plugin header and the ABSPATH check.

WordPress Admin Footer Text


// Change the WordPress admin footer text to show your agency name
function my_functionality_footer_text() {
    echo 'Website built and maintained by <a href="https://yoursite.com/" target="_blank">Your Agency Name</a>';
}
add_filter( 'admin_footer_text', 'my_functionality_footer_text' );

This code customizes the footer text in the WordPress admin area so that it displays your own message instead of the default WordPress credit. It does this by creating a function that outputs a custom string and then using the admin_footer_text filter to replace the existing text with the one you provide. In this example, the footer is changed to read “Website built and maintained by Your Agency Name,” which is a simple way to brand the admin area for your clients.

WordPress Login Page Logo


// Add a custom logo to the WordPress login page
function my_functionality_login_logo() {
    $logo_url = esc_url( get_stylesheet_directory_uri() . '/images/logo.png' );
    ?>
    <style>
        .login h1 a {
            background-image: url('<?php echo $logo_url; ?>');
            width: 200px;
            height: 100px;
            background-size: contain;
        }
    </style>
    <?php
}
add_action( 'login_enqueue_scripts', 'my_functionality_login_logo' );

// Change the login logo link to the site home
function my_functionality_login_logo_url() {
    return home_url();
}
add_filter( 'login_headerurl', 'my_functionality_login_logo_url' );

// Change the login logo title text
function my_functionality_login_logo_url_title() {
    return get_bloginfo( 'name' );
}
add_filter( 'login_headertext', 'my_functionality_login_logo_url_title' );

This code customizes the WordPress login screen by replacing the default WordPress logo with your own. It injects a small style block on the login page that sets a custom background image, width, and height for the logo area. In addition, it changes the logo link so that clicking it takes users back to your site’s homepage instead of WordPress.org, and updates the hover text to show your site’s name. Together, these changes give the login screen a more branded and professional look.

Discourage Search Engines Warning


// Show a warning banner in the admin area if search engines are discouraged
function my_functionality_indexing_warning() {
    if ( get_option( 'blog_public' ) == '0' ) {
        echo '<div class="notice notice-warning">
            <p><strong>Warning:</strong> Search engines are discouraged from indexing this site. 
            <a href="' . esc_url( admin_url( 'options-reading.php' ) ) . '">Update this setting</a>.</p>
        </div>';
    }
}
add_action( 'admin_notices', 'my_functionality_indexing_warning' );

This code displays a warning message in the WordPress admin area if the site is set to discourage search engines from indexing it. It works by checking the blog_public option, which controls whether search engines are allowed to crawl the site. If that option is set to 0, meaning indexing is discouraged, the function outputs a yellow WordPress admin notice with a warning message. The function is hooked into the admin_notices action so that the message automatically appears at the top of the admin dashboard when the condition is met.

Restrict Admin Menu Items


// Restrict admin menu items
function my_functionality_remove_menus() {
    if ( ! current_user_can( 'manage_options' ) ) {
        remove_menu_page( 'tools.php' );
        remove_menu_page( 'plugins.php' );
        remove_menu_page( 'options-general.php' );
    }
}
add_action( 'admin_menu', 'my_functionality_remove_menus', 999 );

This code hides certain admin menu items in WordPress for users who do not have full administrator privileges. It works by checking whether the current user has the manage_options capability, which is typically reserved for administrators. If they do not, the function removes the Tools, Plugins, and Settings menu items from the admin dashboard using remove_menu_page(). By hooking into the admin_menu action with a high priority, the changes take effect after the menu has been built, ensuring those options are hidden from non-admin users and keeping the dashboard cleaner and safer from accidental changes.

Disable WordPress Emojis


// Disable WordPress emojis
function my_functionality_disable_emojis() {
    remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'wp_print_styles', 'print_emoji_styles' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );
}
add_action( 'init', 'my_functionality_disable_emojis' );

This code disables the built-in emoji functionality in WordPress. By default, WordPress loads extra scripts and styles to handle emojis across browsers, even if you don’t use them. The function removes those actions from both the front end and the admin area so that the emoji detection script and related styles are no longer added. This helps reduce unnecessary code being loaded on each page, making the site a little lighter and faster.

Year Shortcode


// Year shortcode
function my_functionality_year_shortcode() {
    return date('Y');
}
add_shortcode( 'year', 'my_functionality_year_shortcode' );

This code creates a simple shortcode in WordPress that outputs the current year. It defines a function that returns the year using PHP’s date('Y') function and then registers that function with the shortcode tag [year]. When the shortcode is placed inside a post, page, or footer area, WordPress automatically replaces it with the current year. This is especially useful for keeping copyright notices and similar content up to date without needing to edit them manually each year.

Share This Article!
FacebookXLinkedInEmail
Mark Westguard

Mark Westguard

WS Form

Mark is the founder of WS Form, a WordPress form plugin at the forefront of innovative form-building solutions. His career, spanning over 25 years, includes running web agencies in both the UK and the USA. Mark is a familiar face at flagship WordCamp events, where he actively participates and sponsors, with a commitment to advancing the WordPress ecosystem.

Come Join Us!

Join the #1 WordPress Community and dive into conversations covering every aspect of running an agency!

Join Group

Kyle Van Deusen

Community Manager

Latest Events

September 16, 2025

Termageddon 2.0

Better Tools, Smoother Workflows, Happier Clients

August 19th, 2025

Which WordPress Page Builder is the Most Accessible?

The 2025 Page Builder Accessibility Report

August 15, 2025

Managing Your Agency with Moxie

Can this all-in-one solution help you streamline your agency and calm the chaos?
Care Plan Toolkit

Save time, boost profits, and confidently manage client websites with proven tools, tips, and resources.

Download Free
Bento Toolkit
The Friday Chaser

Wash down the week with the best of The Admin Bar! News, tips, and the best conversations delivered straight to your inbox every Friday!

Subscribe Today
616203a54be18ec58ad6c3d5c2c8a732

More Articles

Barfly profile elsie gilmore
September 22, 2025

Member Profile: Elsie Gilmore

Elsie Gilmore has been at this game for over two decades — long before WordPress was …

Barfly profile bj bowen
September 15, 2025

Member Profile: BJ Bowen

BJ Bowen’s path into web design and SEO has been anything but linear. From her early …

Cleanshot 2025 09 08 at 15.22.24@2x
September 10, 2025

Can you trust AI to write your website’s Privacy Policy?

Yes, AI can write your Privacy Policy — but chances are you (and the law) won’t like the result.

2025phone

Join the #1 WordPress Community

The Admin Bar community is at the heart of what we do. Join in on the daily conversation and get involved.

Request Membership
The Admin Bar logo.

Explore

Community

Events

Articles

Products

Newsletter

Agency Report Card

Care Plan Toolkit

Noted!

Barfly Login

Policies

Privacy Policy

Terms of Service

Affiliate Agreement

Affiliate Disclaimer

Accessibility Statement

Privacy Settings

Misc.

Advertise

Login

Contact

© 2017-2025 The Admin Bar (a Division of OGAL Web Design) — All Rights Reserved

The Admin Bar logo.
  • Get Involved
    • Facebook Group
    • Barfly Community
    • TABLE Mastermind
  • Learn
    • Articles
    • Events
    • Newsletter
    • YouTube
    • WordPress Professionals Survey
    • SEO Weekly
    • Security Weekly
    • Accessibility Weekly
  • Products
  • About
  • Free Stuff
YouTube Facebook
Sell More Care Plans
Care Plan Toolkit

Save time, boost profits, and confidently manage client websites with proven tools, tips, and resources.

Download Free
Bento Toolkit