WP_REST_Comments_Controller::check_comment_author_email
Checks a comment author email for validity.
Accepts either a valid email address or empty string as a valid comment author email address. Setting the comment author email to an empty string is allowed when a comment is being updated.
Метод класса: WP_REST_Comments_Controller{}
Хуков нет.
Возвращает
Строку|WP_Error. The sanitized email address, if valid, otherwise an error.
Использование
$WP_REST_Comments_Controller = new WP_REST_Comments_Controller(); $WP_REST_Comments_Controller->check_comment_author_email( $value, $request, $param );
- $value(строка) (обязательный)
- Author email value submitted.
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
- $param(строка) (обязательный)
- The parameter name.
Список изменений
| С версии 4.7.0 | Введена. |
Код WP_REST_Comments_Controller::check_comment_author_email() WP REST Comments Controller::check comment author email WP 6.8.3
public function check_comment_author_email( $value, $request, $param ) {
$email = (string) $value;
if ( empty( $email ) ) {
return $email;
}
$check_email = rest_validate_request_arg( $email, $request, $param );
if ( is_wp_error( $check_email ) ) {
return $check_email;
}
return $email;
}