bbp_get_topic_forum_id( int $topic_id )

Return the forum id a topic belongs to

Description

Parameters

$topic_id

(Optional) Topic id

Return

(int) Topic forum id

Source

File: bp-forums/topics/template.php

1787
1788
1789
1790
1791
1792
function bbp_get_topic_forum_id( $topic_id = 0 ) {
    $topic_id = bbp_get_topic_id( $topic_id );
    $forum_id = get_post_meta( $topic_id, '_bbp_forum_id', true );
 
    return (int) apply_filters( 'bbp_get_topic_forum_id', (int) $forum_id, $topic_id );
}

Changelog

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