You can make more readable, like. Small notes at the code. As a hint, the template tag is_page() supports an array of values – is_page( [ 'login', 'register' ] )
.
add_action( 'template_redirect', 'login_redirect' );
function login_redirect() {
// If user is NOT logged in, doing nothing.
if ( ! is_user_logged_in() ) {
return;
}
// This OR (||) this. is_page supports an array of different values.
if ( is_page( [ 'login', 'register' ] ) ) {
wp_redirect ( site_url( '/account' ) );
exit;
}
}