Action hook 'rest_delete_comment'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php at line 1035

View Source

rest_delete_comment

Action Hook
Description
Fires after a comment is deleted via the REST API.

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php View on GitHub
Hook Type Action
Line Number 1035

Hook Parameters

Type Name Description
WP_Comment $comment The deleted comment data.
WP_REST_Response $response The response returned from the API.
WP_REST_Request $request The request sent to the API.

Usage Examples

Basic Usage
<?php
// Hook into rest_delete_comment
add_action('rest_delete_comment', 'my_custom_function', 10, 3);

function my_custom_function($comment, $response, $request) {
    // Your custom code here
}

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:1035 - How this hook is used in WordPress core
<?php
1030  		 *
1031  		 * @param WP_Comment       $comment  The deleted comment data.
1032  		 * @param WP_REST_Response $response The response returned from the API.
1033  		 * @param WP_REST_Request  $request  The request sent to the API.
1034  		 */
1035  		do_action( 'rest_delete_comment', $comment, $response, $request );
1036  
1037  		return $response;
1038  	}
1039  
1040  	/**

PHP Documentation

<?php
/**
		 * Fires after a comment is deleted via the REST API.
		 *
		 * @since 4.7.0
		 *
		 * @param WP_Comment       $comment  The deleted comment data.
		 * @param WP_REST_Response $response The response returned from the API.
		 * @param WP_REST_Request  $request  The request sent to the API.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
Related Hooks

Related hooks will be displayed here in future updates.