Today WordPress is the most liked CMS blog system. It has huge extensibility and ease to manage. Even a user who does not have programming skills, can easily manage WordPress hosted website. Using different plugins, we can enhance WordPress site functionality. Add new features using plugin management module.
In this post we will showing you How to create custom WordPress plugin from scratch. WordPress plugin provide hook functions, which can be integrated with it and work like part of it. Lets start it…
Steps to Create Custom WordPress Plugin from Start
WordPress Plugin files store under wp-content/plugins/ directory. So if your first custom plugin name is sample-plugin then create a PHP file using same name like sample-plugin.php. Must choose unique plugin name.
Now place below code inside sample-plugin.php file. These are the basic plugin parameters.
Upload this file on WordPress directory. File structure should be like wp-content/plugins/sample-plugin/sample-plugin.php
After doing this check in WordPress admin dashboard under Plugins -> Installed Plugins. You will found installed sample-plugin named plugin. Now activate this plugin to integrate with WordPress site.
Add Plugin Option in WordPress Side Menu:
To show this new created sample plugin in WordPress side bar add below code in sample-plugin.php file.
Now Sample Plugin Menu option is showing in WordPress side bar. Check above screenshot.
Create Custom Function in Plugin to Add New Feature:
As you check in above add_action code. we have added “start_init” parameter as a function. You can define any custom code inside this function. See below example code.
So now your plugin is ready to use. By following these steps you can create own custom WordPress Plugin.