rest_prepare_comment

rest_prepare_comment

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.8.3

apply_filters('rest_prepare_comment') is found 2 times:

  • /wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php line 1057
     
    		// Don't prepare the response body for HEAD requests.
    		if ( $request->is_method( 'HEAD' ) ) {
    			/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php */
    			return apply_filters( 'rest_prepare_comment', new WP_REST_Response( array() ), $comment, $request );
    		}
    
    		$fields = $this->get_fields_for_response( $request );
    		$data   = array();
    
    		if ( in_array( 'id', $fields, true ) ) {
    
  • /wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php line 1157
    		 * @param WP_REST_Response  $response The response object.
    		 * @param WP_Comment        $comment  The original comment object.
    		 * @param WP_REST_Request   $request  Request used to generate the response.
    		 */
    		return apply_filters( 'rest_prepare_comment', $response, $comment, $request );
    	}
    
    	/**
    	 * Prepares links for the request.
    	 *
    	 * @since 4.7.0