rest_comment_trashable
Filters whether a comment can be trashed via the REST API.
Return false to disable trash support for the comment.
Использование
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.
Список изменений
| С версии 4.7.0 | Введена. |
Где вызывается хук
rest_comment_trashable
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 980
$supports_trash = apply_filters( 'rest_comment_trashable', ( EMPTY_TRASH_DAYS > 0 ), $comment );