I have used such a code to display the captcha error on the login page that I have designed (this code is located in the functions.php
file):
$error_codes = join( ',' , $user->get_error_codes() );
$error_codes ->add( 'error_captcha', 'error_captcha' );
return $error_codes;
But it keeps showing me the following error and I don't know what to do:
Fatal error: Uncaught TypeError: join(): Argument #2 ($array) must be of type ?array, bool given
$user->get_error_codes()
returns array or null: implode(',' , $user->get_error_codes() ?: []);
$errorcodes->add
will throw error, because implode
(join
is alias) returns string. And string does not have any methods. Don't know what you want to do here