Sometimes, one extension’s ability to function depends on the presence of another extension. The pm_Extension class is used to collect information and perform basic operations on extensions:

  • Retrieve information on installed extensions,
  • Check extensions version, state,
  • Install/uninstall, enable/disable extensions.

Retrieving Extensions Data

Use the following methods to retrieve information on installed extensions.

The following code retrieves all installed extensions, then fetches their IDs and activity states.

$extensions = pm_Extension::getExtensions();
foreach ($extensions as $extension) {

The following methods fetch the extension’s data:

The following code retrieves the WordPress Toolkit extension (ID: "wp-toolkit"), then fetches its display name and activity state.

$extension = pm_Extension::getById("wp-toolkit");

Controlling Extensions

The pm_Extension class also provides methods to enable and disable installed extensions, and to install and uninstall extensions: