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_cause() WordPress Method

The WP_Recovery_Mode_Email_Service::get_cause() method is used to retrieve the cause of an error from a WordPress site. This is useful for debugging purposes.

WP_Recovery_Mode_Email_Service::get_cause( array $extension ) #

Gets the description indicating the possible cause for the 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

(string) Message about which extension caused the error.


Top ↑

Source

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

	private function get_cause( $extension ) {

		if ( 'plugin' === $extension['type'] ) {
			$plugin = $this->get_plugin( $extension );

			if ( false === $plugin ) {
				$name = $extension['slug'];
			} else {
				$name = $plugin['Name'];
			}

			/* translators: %s: Plugin name. */
			$cause = sprintf( __( 'In this case, WordPress caught an error with one of your plugins, %s.' ), $name );
		} else {
			$theme = wp_get_theme( $extension['slug'] );
			$name  = $theme->exists() ? $theme->display( 'Name' ) : $extension['slug'];

			/* translators: %s: Theme name. */
			$cause = sprintf( __( 'In this case, WordPress caught an error with your theme, %s.' ), $name );
		}

		return $cause;
	}


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.