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.
- 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”.
- 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!