rest_pre_insert_comment

Advertisement

Summery Summery

Filters a comment before it is inserted via the REST API.

Syntax Syntax

apply_filters( 'rest_pre_insert_comment', array|WP_Error $prepared_comment, WP_REST_Request $request )

Description Description

Allows modification of the comment right before it is inserted via wp_insert_comment(). Returning a WP_Error value from the filter will shortcircuit insertion and allow skipping further processing.

Parameters Parameters

$prepared_comment

The prepared comment data for wp_insert_comment().

$request

Request used to insert the comment.

Source Source

File: wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

Advertisement

Changelog Changelog

Changelog
Version Description
4.8.0 $prepared_comment can now be a WP_Error to shortcircuit insertion.
4.7.0 Introduced.

Advertisement

Leave a Reply