wp_get_plugin_error()WP 5.2.0

Gets the error that was recorded for a paused plugin.

Хуков нет.

Возвращает

Массив|false. Array of error information as returned by error_get_last(), or false if none was recorded.

Использование

wp_get_plugin_error( $plugin );
$plugin(строка) (обязательный)
Path to the plugin file relative to the plugins directory.

Заметки

  • Global. WP_Paused_Extensions_Storage. $_paused_plugins

Список изменений

С версии 5.2.0 Введена.

Код wp_get_plugin_error() WP 6.5.2

function wp_get_plugin_error( $plugin ) {
	if ( ! isset( $GLOBALS['_paused_plugins'] ) ) {
		return false;
	}

	list( $plugin ) = explode( '/', $plugin );

	if ( ! array_key_exists( $plugin, $GLOBALS['_paused_plugins'] ) ) {
		return false;
	}

	return $GLOBALS['_paused_plugins'][ $plugin ];
}