wp_get_plugin_error() WordPress Function

The wp_get_plugin_error() function is used to get the first error encountered while using a plugin. This function is useful for debugging purposes.

wp_get_plugin_error( string $plugin ) #

Gets the error that was recorded for a paused plugin.


Parameters

$plugin

(string)(Required)Path to the plugin file relative to the plugins directory.


Top ↑

Return

(array|false) Array of error information as returned by error_get_last(), or false if none was recorded.


Top ↑

Source

File: wp-admin/includes/plugin.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.2.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.