bbp_get_search_url( $default = true )

Return the search url

Description

Return

(string) Search url

Source

File: bp-forums/search/template.php

260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
function bbp_get_search_url( $default = true ) {
    global $wp_rewrite;
 
    // Pretty permalinks
    if ( $wp_rewrite->using_permalinks() ) {
        $url = $wp_rewrite->root . bbp_get_search_slug();
        $url = home_url( user_trailingslashit( $url ) );
 
    // Unpretty permalinks
    } else {
        $url = add_query_arg( array( bbp_get_search_rewrite_id() => '' ), home_url( '/' ) );
    }
 
    if ( true === $default ) {
        return apply_filters( 'bbp_get_search_url', add_query_arg( 'bp_search', 1, $url ) );
    } else {
        return apply_filters( 'bbp_get_search_url', $url );
    }
 
}

Changelog

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.