Automattic\WooCommerce\Internal\StockNotifications

Notification::get_unsubscribe_key │ public │ WC 1.0

Generate an unsubscribe key and store its hash.

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

Хуков нет.

Возвращает

string. The generated unsubscribe key.

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

$Notification = new Notification();
$Notification->get_unsubscribe_key( $persist ): string;
$persist(true|false) (обязательный)
If true, save the changes to the database.

Код Notification::get_unsubscribe_key() WC 11.3.0

public function get_unsubscribe_key( bool $persist ): string {
	$key = wp_generate_password( 20, false );
	$this->update_meta_data( 'unsubscribe_action_key', wp_fast_hash( $key ) );

	if ( $persist ) {
		$this->save();
	}

	return $key;
}