php – How to Fix Undefined array key “action” on WordPress site running on Php8

I’m getting error PHP message: PHP Warning: Undefined array key “action” for this code:

function disable_lost_password() {
    if ( in_array( $_GET('action'), array('lostpassword', 'retrievepassword') ) ) {
        wp_redirect( wp_login_url(), 301 );
        exit;
    }
}
add_action( "init", "disable_lost_password" );

How to fix it?