This won’t ever return true:
if ( is_single( '404.php' ) ) {}
The is_single()
conditional only returns true in a single blog post context. The parameter it accepts is a post ID, slug, or title.
The 404.php
file is a template file, not a post. Use is_404()
instead:
if ( is_404() ) {}