bbp_get_view_url( string $view = false )

Return the view url

Description

Parameters

$view

(Optional) View id

Default value: false

Return

(string) View url (or home url if the view was not found)

Source

File: bp-forums/common/template.php

2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
function bbp_get_view_url( $view = false ) {
    global $wp_rewrite;
 
    $view = bbp_get_view_id( $view );
    if ( empty( $view ) )
        return home_url();
 
    // Pretty permalinks
    if ( $wp_rewrite->using_permalinks() ) {
        $url = $wp_rewrite->root . bbp_get_view_slug() . '/' . $view;
        $url = home_url( user_trailingslashit( $url ) );
 
    // Unpretty permalinks
    } else {
        $url = add_query_arg( array( bbp_get_view_rewrite_id() => $view ), home_url( '/' ) );
    }
 
    return apply_filters( 'bbp_get_view_link', $url, $view );
}

Changelog

Changelog
Version Description
bbPress (r2789) 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.