WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp transition comment status

Contents

Description

Call hooks for when a comment status transition occurs.

Calls hooks for comment status transitions. If the new comment status is not the same as the previous comment status, then two hooks will be ran, the first is 'transition_comment_status' with new status, old status, and comment data. The next action called is 'comment_OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the $new_status parameter and the OLDSTATUS is $old_status parameter; it has the comment data.

The final action will run whether or not the comment statuses are the same. The action is named 'comment_NEWSTATUS_COMMENTTYPE', NEWSTATUS is from the $new_status parameter and COMMENTTYPE is comment_type comment data.

Usage

<?php wp_transition_comment_status$new_status$old_status$comment ?>

Parameters

$new_status
(string) (required) New comment status.
Default: None
$old_status
(string) (required) Previous comment status.
Default: None
$comment
(object) (required) Comment data.
Default: None

Return Values

(void) 
This function does not return a value.

Examples

Notes

Change Log

Since: 2.7.0

Source File

wp_transition_comment_status() is located in wp-includes/comment.php.

Related