How to Build a WordPress Plugin

In this project we learn how to build a WordPress plugin. We will start with an overview of what plugins are and how they work. We will then move into best practices for coding in the WordPress environment and some basic functions and reference material you need to know. In the process you'll learn actions, filters and how to create widgets and shortcodes. You'll even learn how to integrate with 3rd party APIs and create your own WordPress plugins from scratch.

Cover wordpress plugin

5 Achievements

How WordPress Plugins Work

How WordPress Plugins Work

WordPress plugins add or change functionality to a WordPress site. Just about anything you can program outside of WordPress, you can likely come up with a way to integrate it into a WordPress site via a plugin or turn it into a plugin itself. Likewise when you feel functionality is missing from a part of WordPress, a plugin can add that functionality. It does this by tying into various programmatic hooks that allow developers to execute their own code at just about any point when WordPress does something. In this first stage we will cover what plugins are and how they work from a high level perspective.

Hide 7 Steps
Building a WordPress Plugin Settings Page

Building a WordPress Plugin Settings Page

Some plugins operate without any user customization. They may just add a widget to the site or some shortcodes that don’t require any settings. Or they may require a huge number of settings and have several settings pages in the admin area. For our plugin we will design a single settings page where the user can add their username and see information about their account that they can add in various ways to their site.

Connecting WordPress Plugins with 3rd Party APIs

Connecting WordPress Plugins with 3rd Party APIs

When your plugin pulls in content from another website or interacts with data stored outside of WordPress you will likely have to work with an API. API stands for application programming interface, which is what many web apps use to communicate with each other. For our project we will connect to the Treehouse profile API that comes in the form of a JSON file. Since many sites use JSON, this skill will be something you will likely be able to use in other projects.

Building WordPress Template Tags, Widgets, and Shortcodes

Building WordPress Widgets, and Shortcodes

When a plugin requires things to show up on the front-end of the site developers will often use a one or several widgets, shortcodes or template tags. Widgets are a special type of plugin that gets added to the widgets sections in the admin area and allows site owners to drag and drop your content or widget into widgetized areas on their site. Shortcodes are simplified macros that site editors can easily add into content fields when editing posts and pages. Template tags let developers add your plugin content directly into a theme template. In this stage we will look at how to build each of these.

Show 10 Steps
Launching and Supporting a WordPress Plugin

Launching and Supporting a WordPress Plugin

If you only plan to use your plugin internally on a specific project you don’t have to worry about releasing and supporting your plugin. However, if you plan on adding your plugin to the WordPress plugin repository or selling it as a premium plugin you will have to put some serious thought into planning it’s launch, marketing, and support. In this final stage we will go over best practices for releasing and supporting WordPress plugins.

Show 7 Steps

What you'll learn

  • WordPress
  • Plugin Development
  • Connecting with APIs


  • Zac Gordon

    Zac is the WordPress teacher at Treehouse. He has an extensive background in web design and WordPress education, having taught and help run college and high school web programs. You can often find him attending and speaking at local WordCamp meetups.

Download videos

You have to sign up for Treehouse in order to download course videos.

Sign up