woocommerce_rest_pre_insert_product_review

FILTER woocommerce\includes\rest-api\Controllers\Version3\class-wc-rest-product-reviews-controller.php (ligne 458) github
Filters a review before it is inserted via the REST API. Allows modification of the review right before it is inserted via wp_insert_comment(). Returning a WP_Error value from the filter will shortcircuit insertion and allow skipping further processing.

Paramètres

Entrée :
$prepared_review, $request
Sortie :
@param array|WP_Error  $prepared_review The prepared review data for wp_insert_comment().
@param WP_REST_Request $request          Request used to insert the review.

Utilisation

// Modifier la valeur avec le filtre 'woocommerce_rest_pre_insert_product_review'
add_filter('woocommerce_rest_pre_insert_product_review', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre($prepared_review) {
    // Modifier la valeur
    return $prepared_review;
}

Actualités

Chargement des actualités...