What are the hierarchy of filenames while initialising a WordPress plugin?

WordPress has recommended to have the filename similar to the name of the plugin. There is no other information about the hierarchy of filenames of a WordPress Plugin. Also I don’t find plugins following any rule for naming the file which initialises the WordPress plugin.

Most of the plugins use the filename as my-custom-plugin.php. Some plugins use the filename as my_custom_plugin.php, some as bootstrap.php and some as loader.php. And I even saw one plugin having filenames like my-custom-plugin.php and loader.php, where loader.php initialises the plugin not my-custom-plugin.php.

How it works? How WordPress looks for the file which initialises the plugin?

1 Answer
1

WordPress looks for the Plugin Header in the php files. The main Plugin file should have a header like this:

<?php
/**
 * Plugin Name: Name Of The Plugin
 * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
 * Description: A brief description of the Plugin.
 * Version: The Plugin's Version Number, e.g.: 1.0
 * Author: Name Of The Plugin Author
 * Author URI: http://URI_Of_The_Plugin_Author
 * License: A "Slug" license name e.g. GPL2
 */

For more info, look here: http://codex.wordpress.org/Writing_a_Plugin#File_Headers

Happy Coding,

Kuchenundkakao

Leave a Comment