rest_after_insert_comment
Action HookDescription
Updates a comment.Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
View on GitHub
|
Hook Type | Action |
Line Number | 923 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_REST_Request
|
$request
|
Full details about the request. |
Usage Examples
Basic Usage
<?php
// Hook into rest_after_insert_comment
add_action('rest_after_insert_comment', 'my_custom_function', 10, 1);
function my_custom_function($request) {
// Your custom code here
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:923
- How this hook is used in WordPress core
<?php
918 }
919
920 $request->set_param( 'context', 'edit' );
921
922 /** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php */
923 do_action( 'rest_after_insert_comment', $comment, $request, false );
924
925 $response = $this->prepare_item_for_response( $comment, $request );
926
927 return rest_ensure_response( $response );
928 }
PHP Documentation
<?php
/**
* Updates a comment.
*
* @since 4.7.0
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response|WP_Error Response object on success, or error object on failure.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
Related Hooks
Related hooks will be displayed here in future updates.