bbp_is_search()
Check if current page is a search page
Description
Return
(bool) Is it a search page?
Source
File: bp-forums/common/template.php
function bbp_is_search() { global $wp_query; // Bail if search is disabled if ( ! bbp_allow_search() ) return false; // Assume false $retval = false; // Check query if ( !empty( $wp_query->bbp_is_search ) && ( true === $wp_query->bbp_is_search ) ) $retval = true; // Check query name if ( empty( $retval ) && bbp_is_query_name( bbp_get_search_rewrite_id() ) ) $retval = true; // Check $_GET if ( empty( $retval ) && isset( $_REQUEST[ bbp_get_search_rewrite_id() ] ) && empty( $_REQUEST[ bbp_get_search_rewrite_id() ] ) ) $retval = true; return (bool) apply_filters( 'bbp_is_search', $retval ); }
Changelog
Version | Description |
---|---|
bbPress (r4579) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.