filtrod 4.7.0
rest_pre_insert_comment
Opis — z kodu źródłowego
Filters a comment before it is inserted via the REST API.
Allows modification of the comment right before it is inserted via wp_insert_comment(). Returning a WP_Error value from the filter will short-circuit insertion and allow skipping further processing.
Parametry
| Parametr | Typ | Opis |
|---|---|---|
$prepared_comment | array | \WP_Error | The prepared comment data for wp_insert_comment(). |
$request | \WP_REST_Request | Request used to insert the comment. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'rest_pre_insert_comment', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'rest_pre_insert_comment', 'twoja_funkcja', 10, 2 );
function twoja_funkcja($param_1, $param_2) {
// Twój kod
}Popularne w tej kategorii