I am trying to add a conditional to enqueue script only for 404 page. Theoretically I would have to use is_404() right? Well it does not work:
if ( is_page_template('404.php') ) {
add_action('wp_enqueue_scripts', 'scripts_404');
}
if ( is_404() ) {
add_action('wp_enqueue_scripts', 'scripts_404');
}
nor does the is_page_template work. However if I add this line without conditionals, it works just fine. Any ideas or am I missing something?
Thanks in advance.