rest_comment_trashable filter-hookWP 4.7.0

Filters whether a comment can be trashed via the REST API.

Return false to disable trash support for the comment.

Usage

add_filter( 'rest_comment_trashable', 'wp_kama_rest_comment_trashable_filter', 10, 2 );

/**
 * Function for `rest_comment_trashable` filter-hook.
 * 
 * @param bool       $supports_trash Whether the comment supports trashing.
 * @param WP_Comment $comment        The comment object being considered for trashing support.
 *
 * @return bool
 */
function wp_kama_rest_comment_trashable_filter( $supports_trash, $comment ){

	// filter...
	return $supports_trash;
}
$supports_trash(true|false)
Whether the comment supports trashing.
$comment(WP_Comment)
The comment object being considered for trashing support.

Changelog

Since 4.7.0 Introduced.

Where the hook is called

WP_REST_Comments_Controller::delete_item()
rest_comment_trashable
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 967
$supports_trash = apply_filters( 'rest_comment_trashable', ( EMPTY_TRASH_DAYS > 0 ), $comment );

Where the hook is used in WordPress

Usage not found.