WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Recovery_Mode_Email_Service::maybe_send_recovery_mode_email() public WP 5.2.0

Sends the recovery mode email if the rate limit has not been sent.

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

Хуков нет.

Возвращает

true/WP_Error. True if email sent, WP_Error otherwise.

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

$WP_Recovery_Mode_Email_Service = new WP_Recovery_Mode_Email_Service();
$WP_Recovery_Mode_Email_Service->maybe_send_recovery_mode_email( $rate_limit, $error, $extension );
$rate_limit(число) (обязательный)
Number of seconds before another email can be sent.
$error(массив) (обязательный)
Error details from {@see error_get_last()}
$extension(массив) (обязательный)

The extension that caused the error.

  • slug(строка)
    The extension slug. The plugin or theme's directory.

  • type(строка)
    The extension type. Either 'plugin' or 'theme'.

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

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

Код WP_Recovery_Mode_Email_Service::maybe_send_recovery_mode_email() WP 5.5.1

wp-includes/class-wp-recovery-mode-email-service.php
<?php
public function maybe_send_recovery_mode_email( $rate_limit, $error, $extension ) {

	$last_sent = get_option( self::RATE_LIMIT_OPTION );

	if ( ! $last_sent || time() > $last_sent + $rate_limit ) {
		if ( ! update_option( self::RATE_LIMIT_OPTION, time() ) ) {
			return new WP_Error( 'storage_error', __( 'Could not update the email last sent time.' ) );
		}

		$sent = $this->send_recovery_mode_email( $rate_limit, $error, $extension );

		if ( $sent ) {
			return true;
		}

		return new WP_Error(
			'email_failed',
			sprintf(
				/* translators: %s: mail() */
				__( 'The email could not be sent. Possible reason: your host may have disabled the %s function.' ),
				'mail()'
			)
		);
	}

	$err_message = sprintf(
		/* translators: 1. Last sent as a human time diff, 2. Wait time as a human time diff. */
		__( 'A recovery link was already sent %1$s ago. Please wait another %2$s before requesting a new email.' ),
		human_time_diff( $last_sent ),
		human_time_diff( $last_sent + $rate_limit )
	);

	return new WP_Error( 'email_sent_already', $err_message );
}