rest_after_insert_comment хук-событиеWP 5.0.0

Fires completely after a comment is created or updated via the REST API.

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

add_action( 'rest_after_insert_comment', 'wp_kama_rest_after_insert_comment_action', 10, 3 );

/**
 * Function for `rest_after_insert_comment` action-hook.
 * 
 * @param WP_Comment      $comment  Inserted or updated comment object.
 * @param WP_REST_Request $request  Request object.
 * @param bool            $creating True when creating a comment, false when updating.
 *
 * @return void
 */
function wp_kama_rest_after_insert_comment_action( $comment, $request, $creating ){

	// action...
}
$comment(WP_Comment)
Inserted or updated comment object.
$request(WP_REST_Request)
Request object.
$creating(true|false)
True when creating a comment, false when updating.

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

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

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

WP_REST_Comments_Controller::create_item()
rest_after_insert_comment
WP_REST_Comments_Controller::update_item()
rest_after_insert_comment
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 756
do_action( 'rest_after_insert_comment', $comment, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 910
do_action( 'rest_after_insert_comment', $comment, $request, false );

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

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