The answer is right there in your error. Your first if
checks that $reg_errors
is definitely an instance of WP_Error
, but your elseif
doesn’t. You need:
elseif ( is_wp_error( $reg_errors ) && count( $reg_errors->get_error_messages() ) < 1 )
The answer is right there in your error. Your first if
checks that $reg_errors
is definitely an instance of WP_Error
, but your elseif
doesn’t. You need:
elseif ( is_wp_error( $reg_errors ) && count( $reg_errors->get_error_messages() ) < 1 )