On this page
WP_Recovery_Mode_Email_Service::get_plugin( array $extension ): array|false
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Return the details for a single plugin based on the extension data from an error.
Parameters
$extensionarray Required-
The extension that caused the error.
slugstringThe extension slug. The directory of the plugin or theme.typestringThe extension type. Either'plugin'or'theme'.
Return
array|false A plugin array get_plugins() or false if no plugin was found.
Source
File: wp-includes/class-wp-recovery-mode-email-service.php. View all references
private function get_plugin( $extension ) {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
// Assume plugin main file name first since it is a common convention.
if ( isset( $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ] ) ) {
return $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ];
} else {
foreach ( $plugins as $file => $plugin_data ) {
if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) {
return $plugin_data;
}
}
}
return false;
}
Related
Uses
| Uses | Description |
|---|---|
| get_plugins() wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
Used By
| Used By | Description |
|---|---|
| WP_Recovery_Mode_Email_Service::get_debug() wp-includes/class-wp-recovery-mode-email-service.php | Return debug information in an easy to manipulate format. |
| WP_Recovery_Mode_Email_Service::get_cause() wp-includes/class-wp-recovery-mode-email-service.php | Gets the description indicating the possible cause for the error. |
Changelog
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_recovery_mode_email_service/get_plugin