Skip to content

Instantly share code, notes, and snippets.

@PUYUP
Created February 20, 2023 23:43
Show Gist options
  • Save PUYUP/1806b5824fe56ce87681ac94232ea408 to your computer and use it in GitHub Desktop.
Save PUYUP/1806b5824fe56ce87681ac94232ea408 to your computer and use it in GitHub Desktop.
function rest_pre_echo_response_handler( $result, $served, $request ) {
$code = ( isset( $result['code'] ) && ! empty( $result['code'] ) ) ? $result['code'] : '';
// Username exist
switch ( $code ) {
case 'existing_user_login':
$result['message'] = __( 'Sorry, that phone number already exists!' );
break;
}
return $result;
}
add_filter( 'rest_pre_echo_response', 'rest_pre_echo_response_handler', 99, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment