To avoid duplicating the same plugin description code for the 150th time, I decided to do it once and fully describe it in this article. In all other articles — I’ll just refer to this one.
So, in order for WordPress to recognize which plugin is located in the «/wp-content/plugins/» directory and be able to install it, you need to declare it properly (more precisely — write a header). To do this, at the very beginning of the main plugin file, create the following comment (providing your plugin details, of course):
<?php /* Plugin Name: Plugin Name Plugin URI: http://plance.top/plugins Description: Description Plugin Name Version: 1.0 Author: Pavel Author URI: http://plance.top/avtor License: GPL2 License URI: https://www.gnu.org/licenses/gpl-2.0.html Domain Path: /languages Text Domain: plugin-lng */
Below is a detailed explanation of each field:
Plugin Name — The name of the plugin that will be displayed in the WordPress admin panel. This is how you’ll find and activate your plugin.
Plugin URI — A link to the plugin’s page. It can lead to the official WordPress repository or to any other page on the web.
Description — A short description of the plugin that is shown in the plugin list in the admin panel. It should be no longer than 140 characters.
Version — The current version of the plugin. It should look like 1.0 or 1.0.3. This allows WP to detect if a newer version is available and offer an update.
Author — The plugin author’s name. If there are multiple authors, you can list them all.
Author URI — A link to the author's website or profile.
License — A short name of the license.
License URI — A URL describing the license used.
Domain Path — The directory where language files are stored. Typically «/languages».
Text Domain — The text domain used for translations.
To be honest, I still don’t quite understand the full purpose of “Domain Path” and “Text Domain.” For localization to work, you still have to manually call the `load_plugin_textdomain` function. Without it, nothing is loaded or detected automatically (maybe I’m missing something).
The absolute minimum required to register a plugin looks like this:
<?php /* Plugin Name: Plugin Name */
That’s all for now.
