WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/is 404

Description

This Conditional Tag checks if 404 error is being displayed (after an "HTTP 404: Not Found" error occurs). This is a boolean function, meaning it returns either TRUE or FALSE.

Usage

<?php is_404(); ?>

Parameters

This tag does not accept any parameters.

Return Values

(boolean) 
True on success, false on failure.

Examples


<?php
if ( is_404() ) {
    
// add search form so that users can search other posts
}
?>

Notes

Change Log

Since: 1.5.0

Source File

is_404() is located in wp-includes/query.php.

Related

See also index of Function Reference and index of Template Tags.