WordPress plugin identification
How to reliably identify a WordPress plugin? Just using their names, surely doesn't work. And spoiler alert: There is probably no easy way to identify plugins with 100% certainty.
Use this
- DVB name (=my own name for this plugin)
- Directory name
- Author name
- Main PHP file name.
Template
This template could be extended quite a bit - But let's keep it simple, not perfect ;)
Class | Identifier | Value |
---|---|---|
Primary | ||
DVB name | ||
Directory name | ||
Author | ||
Main PHP file name | ||
Secondary (main PHP file) | ||
Author URI | ||
Text Domain | ||
Plugin name | ||
@package | ||
Description | ||
External links |
Example: woocommerce-gpf
Class | Identifier | Value |
---|---|---|
Primary | DVB name | woocommerce-gpf
|
Plugin directory name | woocommerce-product-feeds
| |
Author | Ademti | |
Main PHP file name | woocommerce-gpf.php
| |
Secondary | Author URI | https://www.ademti-software.co.uk/ |
Text Domain | --- | |
Plugin name (main PHP file) |
WooCommerce Google Product Feed | |
@package (main PHP file) |
woocommerce-gpf
| |
Description (main PHP file) |
WooCommerce extension that allows you to more easily populate advanced attributes into the Google Merchant Centre feed | |
External links | https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/ (this product is not available anymore as a standalone product) |
Example: woocommerce-pdf-invoices-packing-slips
Class | Identifier | Value |
---|---|---|
Primary | DVB name | woocommerce-pdf-invoices-packing-slips
|
Directory name | woocommerce-pdf-invoices-packing-slips
| |
Author | WP Overnight | |
Main PHP file name | woocommerce-pdf-invoices-packingslips.php
| |
Secondary | Author URI | https://www.wpovernight.com wpovernight.com |
Text Domain | woocommerce-pdf-invoices-packing-slips | |
Plugin name (main PHP file) |
PDF Invoices & Packing Slips for WooCommerce | |
@package (main PHP file) |
--- | |
Description (main PDF file) |
Create, print & email PDF or UBL Invoices & PDF Packing Slips for WooCommerce orders | |
External links | https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-bundle/ (this product is not available anymore as a standalone product) |
Entities
Directory name
Directory name: The name of the directory, directly under wp-content/plugins
, where this plugin is installed:
- Not a perfect way, but an easy start
- This method is widely used in WordPress development and WP-CLI commands
- This is usually the same name as the slug at wordpress.org/plugins
However, this method is not 100% reliable:
- Commercial plugins are usually not included at wordpress.org/plugins and could use the same name
- Independently developed plugins, might also use the same name
- There is no mechanism to assure that plugins don't have the same name. The closest to such a mechanism, is inclusion at wordpress.org/plugins, and as mentioned before, that method isn't enforced
- Some plugins come in different packages, e.g., a 'basic plugin' that has nothing to do with the actual plugin, and an 'application' plugin. In such a case: What's the directory?
Author
- Primary source for finding the author of a plugin: In the header of the main PHP file
- This doesn't have to be the exact name - As long as it is enough to distinguish it from authors of similar plugins
- Example: Ademti is good enough - No need to write down Ademti Software Ltd.
Main PHP file name
Simply the file name of the main PHP file in the plugin's directory.
Slug
The slug at wordpress.org/plugins is usually the same as the directory name mentioned before, but again, only works for plugins that are included at wordpress.org/plugins.
Plugin URI
The plugin URI is a field from the main PHP file header and it usually is the URL of the plugin at the site of the reseller.
BTW: The main PHP file is not automatically the same as the directory name + '.php' - That's only a convention. The main PHP file is identified by WordPress by its header.
Text Domain
The main PHP file usually contains a field called Text Domain. It's usually the same as the directory name and the slug (where relevant).
Directory name + author
This is probably about 100% reliable. Unless there isn't really a reseller → Let's cross that bridge when we get there :)
Directory + main PHP file name
Quite close to 100% reliable: Directory name plus the name of the main PHP file
Main PHP file hash
Create a MD5 hash of a plugin's main php file as identifier. Drawbacks:
- Non-intelligible
- Every different version of a plugin, seems like a different plugin
- Takes work.
Composer
If you control the environment and use a dependency manager like Composer to manage WordPress plugins, you can use package names to uniquely identify plugins. Composer manages each package with a unique name, which can help avoid directory name conflicts.