rest_preprocess_comment

FILTER wp-includes\rest-api\endpoints\class-wp-rest-comments-controller.php (ligne 1477) github
Filters a comment added via the REST API after it is prepared for insertion into the database. Allows modification of the comment right after it is prepared for the database.

Paramètres

Entrée :
$prepared_comment, $request
Sortie :
@param array           $prepared_comment The prepared comment data for `wp_insert_comment`.
@param WP_REST_Request $request          The current request.

Utilisation

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

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

Actualités

Chargement des actualités...