set_comment_cookies хук-событиеWP 3.4.0

Fires after comment cookies are set.

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

add_action( 'set_comment_cookies', 'wp_kama_set_comment_cookies_action', 10, 3 );

/**
 * Function for `set_comment_cookies` action-hook.
 * 
 * @param WP_Comment $comment         Comment object.
 * @param WP_User    $user            Comment author's user object. The user may not exist.
 * @param bool       $cookies_consent Comment author's consent to store cookies.
 *
 * @return void
 */
function wp_kama_set_comment_cookies_action( $comment, $user, $cookies_consent ){

	// action...
}
$comment(WP_Comment)
Comment object.
$user(WP_User)
Comment author's user object. The user may not exist.
$cookies_consent(true|false)
Comment author's consent to store cookies.

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

С версии 3.4.0 Введена.
С версии 4.9.6 The $cookies_consent parameter was added.

Где вызывается хук

В файле: /wp-comments-post.php
set_comment_cookies
wp-comments-post.php 55
do_action( 'set_comment_cookies', $comment, $user, $cookies_consent );

Где используется хук в WordPress

wp-includes/default-filters.php 407
add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 );