apply_filters( 'pre_comment_approved', int|string|WP_Error $approved, array $commentdata )
- Since
- 2.1.0, 4.9.0
Filters a comment's approval status before it is set.
Compatibility
- WordPress
- since 4.9.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
$approvedint|string|WP_Error- The approval status. Accepts 1, 0, 'spam', 'trash', or WP_Error.
$commentdataarray- Comment data.
Where this hook fires · 1
wp-includes/comment.php:1349wp_check_comment_data()
Source code
* and allow skipping further processing. * * @param int|string|WP_Error $approved The approval status. Accepts 1, 0, 'spam', 'trash', * or WP_Error. * @param array $commentdata Comment data. */ return apply_filters( 'pre_comment_approved', $approved, $comment_data );} /** * Checks if a comment contains disallowed characters or words. * * @since 5.5.0Changelog
Introduced in 2.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.9.0
Returning a WP_Error value from the filter will short-circuit comment insertion and allow skipping further processing.from the docblock
2.1.0
Introduced.from the docblock
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.