WP HOOKS
akcjadynamicznyod 2.7.0

comment_{$new_status}_{$comment->comment_type}

Args 2Plik wp-includes/comment.php

Opis — z kodu źródłowego

Fires when the status of a specific comment type is in transition.

The dynamic portions of the hook name, $new_status, and $comment->comment_type, refer to the new comment status, and the type of comment, respectively. Typical comment types include 'comment', 'pingback', or 'trackback'. Possible hook names include:

  • comment_approved_comment
  • comment_approved_pingback
  • comment_approved_trackback
  • comment_unapproved_comment
  • comment_unapproved_pingback
  • comment_unapproved_trackback
  • comment_spam_comment
  • comment_spam_pingback
  • comment_spam_trackback

Hook dynamiczny — możliwe nazwy

comment_approved_commentcomment_approved_pingbackcomment_approved_trackbackcomment_spam_commentcomment_spam_pingbackcomment_spam_trackbackcomment_unapproved_commentcomment_unapproved_pingbackcomment_unapproved_trackback

Parametry

ParametrTypOpis
$comment_idstringThe comment ID as a numeric string.
$comment\WP_CommentComment object.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_action( 'comment_{$new_status}_{$comment->comment_type}', 'twoja_funkcja', 10, 2 );

function twoja_funkcja($param_1, $param_2) {
	// Twój kod
}

Popularne w tej kategorii