Alert: 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.

WP_Recovery_Mode_Email_Service::get_plugin() WordPress Method

The WP_Recovery_Mode_Email_Service::get_plugin() method is used to get the path to the WordPress plugin. This is useful if you need to include the plugin in your recovery mode email service.

WP_Recovery_Mode_Email_Service::get_plugin( array $extension ) #

Return the details for a single plugin based on the extension data from an error.


Parameters

$extension

(array)(Required)The extension that caused the error.

  • 'slug'
    (string) The extension slug. The directory of the plugin or theme.
  • 'type'
    (string) The extension type. Either 'plugin' or 'theme'.


Top ↑

Return

(array|false) A plugin array get_plugins() or false if no plugin was found.


Top ↑

Source

File: wp-includes/class-wp-recovery-mode-email-service.php

	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;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.