WP_Recovery_Mode_Email_Service::get_cause()privateWP 5.2.0

Gets the description indicating the possible cause for the error.

Метод класса: WP_Recovery_Mode_Email_Service{}

Хуков нет.

Возвращает

Строку. Message about which extension caused the error.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_cause( $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.2.0 Введена.

Код WP_Recovery_Mode_Email_Service::get_cause() WP 6.5.2

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