WordPress.org

Codex

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

Function Reference/is search

Description

This Conditional Tag checks if search result page archive is being displayed. This is a boolean function, meaning it returns either TRUE or FALSE.

Usage

<?php is_search(); ?>

Parameters

This tag does not accept any parameters.

Return Values

(boolean) 
True on success, false on failure.

Examples


<?php
if ( is_search() ) {
    
// add external search form (Google, Yahoo, Bing...)
}
?>

Notes

Change Log

Since: 1.5.0

Source File

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

Related

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