How to Create First WordPress Plugin?

Are you a new WordPress developer? Have you started working on WordPress recently? Are you looking to create new WordPress Plugin?

How to create wordpress plugin from scratch? Well, you are at right place.

In this tutorial we will go over how to create your Hello World WordPress Plugin from scratch. This is a step by step guide on WordPress plugin development tutorial .

Before we get started here is a WordPress plugin design and what we are going to do:

  1. We will create simple Hello World WordPress Plugin
  2. Create file crunchify-hello-world.php which has all Plugin code
  3. Create readme.txt file with basic information
    • Plugin Metadata
    • Description
    • Installation Steps
    • FAQ section
    • Screenshots
    • Change log
  4. Plugin will have below functionalities
    • New menu Crunchify Plugin under Settings menu
    • New Plugin admin page
    • User will have option to add value to one Textfield
    • Save button to save setting
    • Plugin will append saved text value to bottom of every post

Let’s get started:

Step-1 Create Plugin Metadata.

Create file crunchify-hello-world.php and put below code first.

Here below fields are absolutely required and should be unique to your plugin:

Step-2 Add submenu section

We are using add_action WordPress hook to add submenu for our plugin.

Step-3 Create plugin setting page

In our case Settings -> Crunchify Plugin.

Crunchify Hello World Plugin Setting Page

Step-4 Append Saved Textfield value to each post

Hello World Plugin appends text to each post

Complete code:

Here is a complete Hello World WordPress Plugin code. Just copy it below and save to file crunchify-hello-world.php file.

Step-5 Create readme.txt file

Here is a sample WordPress plugin readme.txt file.

Now what?

  • Just create folder crunchify-hello-world under /plugins folder and add copy both files there.

That’s it.

Begin Writing Your First WordPress plugin 🙂

Take this code as a sample of your first WordPress Plugin base and modify as per your need. In next tutorial we will go over some more complex array fields for some more functionality.

Leave a Reply