How to create wordpress plugin from scratch

Creating website with WordPress and using theme based on choice makes you happy. But it will be great if you can add some extra functionality using simple add on. WordPress has feature as “wordpress plugin” which can boost you website task and improve quality.

WordPress plugin are written in php language and integrate with wordpress smoothly to add some extra functionality. Here we are learning to create plugin from scratch by following simple steps.

Create simple with simple steps

Outside of configuring wordpress, everything you do in wordpress will be in wp-content folder. All other files are core code and you should not edit it.

Create wordpress plugin folder

Go through wp-content > Plugins to arrive at plugins folders. There will some folder and index.php file which is provided by wordpress. Here you can create custom plugin. I called it customWordpressPlugin. Create folder with this name.

WordPress Plugin Folder

Create php file in
customWordpressPlugin folder

Create index.php file in customWordpressPlugin folder. It is your main php file where you start to write your first plugin logic.

Setup your plugin information

In index.php file, write plugin information which is good practice to know about purpose of plugin.

 * Plugin Name: My First custom Plugin
 * Plugin URI:
 * Description: The very first plugin that I have ever created.
 * Version: 1.0
 * Author: Bugcutter Inc.
 * Author URI:

Now you have created a small custom plugin with minimum steps. You can now activate the plugin from wordpress admin and can use in application.

Activate plugin from WordPress

Go to wordpress dashboard, click on Plugins> Installed Plugins. You will see your plugin with default plugins.

WordPress Admin

Here you will see your plugin name from where you can activate it to use with application.

What now?

This is simple plugin creation. It does not have any use. So now we make it useful by adding simple functionality.

Make your plugin to do something

The easiest way to make things happen in WordPress is with actions and filters.  We create a simple code and append in index.php . It will add “Thank You” note at bottom of every post.

add_action( 'the_content', 'my_thank_you_text' );

function my_thank_you_text ( $content ) {
    return $content .= '<p>Thank you for reading!</p>';

This code hooks into “the_content” action that fires when WordPress renders the post content for your site. When that action fires, WordPress will call our “my_thank_you_text” function that is defined below the “add_action” call.


Here in post you can see result as adding line “Thank you for reading

You can download source code from

Thank you for reading!