Creating a single file WordPress plugin in 2 steps

To create a single file plugin in WordPress is really simple. Following the steps below should leave you with a single file plugin that is ready to be filled with valuable functionality.

  1. Create a new PHP file with a name derived from your chosen Plugin name and store it in the wp-content/plugins directory, e.g. ”wp-content/plugins/FooBar.php”.
  2. Within the PHP file, add the standard plugin information header. Without the standard plugin information header the plugin will never be activated and will never run. The absolute minimum information needed is the plugin name.
<?php
/*
Plugin Name: The FooBar Plugin
*/
?>

That is it! You should now be able to find the plugin on the Plugin management screen. Filling the plugin with valuable functionality is a different story and is left for you to do your self.

Visit the WordPress codex to learn more about writing a WordPress plugin!

This entry was posted in Web Development and tagged , , . Bookmark the permalink.