WordPress plugin identification

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

How to reliably identify a WordPress plugin? Just using their names, surely doesn't work. And spoiler alert: Maybe there is no way to identify plugins without any ambiguity -- Some ideas:

Conclusions

Use:

  1. Directory name
  2. Author name
  3. Main PHP file name.

Template

Class Identifier Value
Primary DVB name
Directory name
Author
Main PHP file name
Secondary Author URI
Text Domain
Plugin name
(main PHP file)
@package
(main PHP file)
Description
(main PDF file)
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

  • Using the plugin's directory name (relative to wp-content/plugins) is one of the more reliable methods for identifying WordPress plugins. 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.

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.

Author name

  • Author name or reseller name? → Author name is used in the header of the main PHP file
  • I don't think I need the exact name: Ademti is good enough - No need to write down Ademti Software Ltd.

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 :)

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 + 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.

See also