bbp_get_view_id( string $view = '' )

Get the view id

Description

Use view id if supplied, otherwise bbp_get_view_rewrite_id() query var.

Parameters

$view

(Optional) View id.

Default value: ''

Return

(bool|string) ID on success, false on failure

Source

File: bp-forums/common/template.php

2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
function bbp_get_view_id( $view = '' ) {
    $bbp = bbpress();
 
    if ( !empty( $view ) ) {
        $view = sanitize_title( $view );
    } elseif ( ! empty( $bbp->current_view_id ) ) {
        $view = $bbp->current_view_id;
    } else {
        $view = get_query_var( bbp_get_view_rewrite_id() );
    }
 
    if ( array_key_exists( $view, $bbp->views ) ) {
        return $view;
    }
 
    return false;
}

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.