Writing a WordPress Plugin

First go to the root of the site.

go to folder /wp-content/

now go to folder /wp-content/plugins/

This is the directory where all the plugin resides.

1. Here create one folder for ouWordPress plugin say my_first_wordpress_plugin , or you can keep any other name as per your convenience.

2. Now create one file here say my_first_wp_plugin.php or any other name can be kept but extension must be .php

Now see your list of WordPress plugins at


Don’t worry, I know your plugin is not listed yet in the list of plugins.

To get this plugin listed, you need to follow step two

Now after step1 where you created files for plugin.

Now Insert following code in our only .php file


	Plugin Name:	My First WordPress Plugin
	Plugin URI:	http://phpscripts.in/my_first_wordpress_plugin
	Description:	A simple plugin for doemonstration
	Version:	1.0
	Author:		Mukesh Dak
	Author URI:	http://mukeshdak.com
	License:	GPL


Here there are few points worth noting.
1. Info Show here is typical but
2. It must be commented.
3. Colon should be there after parameter for identification.
4. Information shown here is indicative only, some more fields can be added here but this is sufficient for listing our plugin in directory of WordPress plugin.

Now again again check you plugin list, there will be addition of this plugin.
Now click on Activate Link to activate your plugin.

Unfortunately our plugin get activated but does not perform any function as code to do so has not been added yet in this file.

Now go to part3 to proceed further.

After Part2, now

add some code in our plugin file to do some action. So add following code in our file.

function my_plugin1_menu()
		'My Plugin1',
			// Page title
		'My Plugin1',
			// Menu title
			// Capability ( below this it will not be shown )
			// menu_slug ( handle ), must of unique
			// This function will be executed when menu is accessed.

function create_my_plugin1_page()
		echo "This is My Plugin1 page";

/* create this menu in Admin */
add_action('admin_menu', 'my_plugin1_menu');

This code will create one menu item in dashboard of administrative users.

Here function create_my_plugin1_page dictates content of the page, when this menu is clicked, a page of of our choice can be generated by using appropriate code.