filtrod 4.4.0
comment_form_fields
Opis
Zmienia kolejność i zawartość pól formularza komentarzy.
Przykład użycia
add_filter( 'comment_form_fields', ... )php
add_filter( 'comment_form_fields', 'wpdocs_comment_fields_order' );
function wpdocs_comment_fields_order( $fields ) {
// przenieś pole komentarza na koniec formularza
$comment = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment;
return $fields;
}
add_filter( 'comment_form_fields', 'wpdocs_comment_fields_order' );
function wpdocs_comment_fields_order( $fields ) {
// przenieś pole komentarza na koniec formularza
$comment = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment;
return $fields;
}Parametry
| Parametr | Typ | Opis |
|---|---|---|
$comment_fields | array | The comment fields. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_filter( 'comment_form_fields', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}
// rejestracja funkcji zwrotnej
add_filter( 'comment_form_fields', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii