rest_pre_insert_product_review

FILTER woocommerce\includes\rest-api\Controllers\Version1\class-wc-rest-product-reviews-v1-controller.php (ligne 300) github
Filter a product review (comment) before it is inserted via the REST API. Allows modification of the comment right before it is inserted via `wp_insert_comment`.

Paramètres

Entrée :
$prepared_review, $request
Sortie :
@param array           $prepared_review The prepared comment data for `wp_insert_comment`.
@param WP_REST_Request $request          Request used to insert the comment.

Utilisation

// Modifier la valeur avec le filtre 'rest_pre_insert_product_review'
add_filter('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...