rest_pre_insert_product_review

rest_pre_insert_product_review

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

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('rest_pre_insert_product_review') is found 1 times:

  • /includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php line 300
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    *
     * @param array           $prepared_review The prepared comment data for `wp_insert_comment`.
     * @param WP_REST_Request $request          Request used to insert the comment.
     */
    $prepared_review = apply_filters( 'rest_pre_insert_product_review', $prepared_review, $request );
     
    $product_review_id = wp_insert_comment( $prepared_review );
    if ( ! $product_review_id ) {
        return new WP_Error( 'rest_product_review_failed_create', __( 'Creating product review failed.', 'woocommerce' ), array( 'status' => 500 ) );
    }