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
806            * Filters whether a comment can be trashed.
807            *
808            * Return false to disable trash support for the post.
809            *
810            * @since 4.7.0
811            *
812            * @param bool    $supports_trash Whether the post type support trashing.
813            * @param WP_Post $comment        The comment object being considered for trashing support.
814            */
815           $supports_trash = apply_filters( 'rest_comment_trashable', ( EMPTY_TRASH_DAYS > 0 ), $comment );
816
817           $request->set_param( 'context', 'edit' );
818
819           if ( $force ) {
820                $previous = $this->prepare_item_for_response( $comment, $request );
821                $result = wp_delete_comment( $comment->comment_ID, true );
822                $response = new WP_REST_Response();
823                $response->set_data( array( 'deleted' => true, 'previous' => $previous->get_data() ) );
824           } else {