apply_filters( 'rest_preprocess_comment', array $prepared_comment, WP_REST_Request $request )
- Since
- 4.7.0
Filters a comment added via the REST API after it is prepared for insertion into the database.
Description
Allows modification of the comment right after it is prepared for the database.
Compatibility
- WordPress
- since 4.7.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$prepared_commentarray- The prepared comment data for
wp_insert_comment. $requestWP_REST_Request- The current request.
Where this hook fires · 1
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:1485WP_REST_Comments_Controller::prepare_item_for_database()
Source code
* * @since 4.7.0 * * @param array $prepared_comment The prepared comment data for `wp_insert_comment`. * @param WP_REST_Request $request The current request. */ return apply_filters( 'rest_preprocess_comment', $prepared_comment, $request ); } /** * Retrieves the comment's schema, conforming to JSON Schema. * * @since 4.7.0Changelog
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.