Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_comment_trashable

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
958            * Filters whether a comment can be trashed via the REST API.
959            *
960            * Return false to disable trash support for the comment.
961            *
962            * @since 4.7.0
963            *
964            * @param bool       $supports_trash Whether the comment supports trashing.
965            * @param WP_Comment $comment        The comment object being considered for trashing support.
966            */
967           $supports_trash = apply_filters( 'rest_comment_trashable', ( EMPTY_TRASH_DAYS > 0 ), $comment );
968
969           $request->set_param( 'context', 'edit' );
970
971           if ( $force ) {
972                $previous = $this->prepare_item_for_response( $comment, $request );
973                $result   = wp_delete_comment( $comment->comment_ID, true );
974                $response = new WP_REST_Response();
975                $response->set_data(
976                     array(