Conditional action hooks
During page request, WordPress actions are triggered in a sequence, therefore you have to register them in time. In your case, wp_head comes after wp_enqueue_scripts, so as a solution, i would all remove them from the wp_head and register them all in a condition, outside of any other action: if ( isset( $_COOKIE[‘user_opt’] ) ) … Read more