WP_Recovery_Mode_Email_Service::get_plugin()
Return the details for a single plugin based on the extension data from an error.
Метод класса: WP_Recovery_Mode_Email_Service{}
Хуков нет.
Возвращает
Массив|false
. A plugin array get_plugins() or false if no plugin was found.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_plugin( $extension );
- $extension(массив) (обязательный)
The extension that caused the error.
-
slug(строка)
The extension slug. The directory of the plugin or theme. - type(строка)
The extension type. Either 'plugin' or 'theme'.
-
Список изменений
С версии 5.3.0 | Введена. |
Код WP_Recovery_Mode_Email_Service::get_plugin() WP Recovery Mode Email Service::get plugin WP 6.6.1
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 ( str_starts_with( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) { return $plugin_data; } } } return false; }