Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Retrieving forum ID from post ID

@_ck_

Participant

It’s extremely easy to get forum <-> topic <-> post relationships in bbPress.

Depending on where you are, you may just be able to do a

global $topic,$bb_post;

Then $topic or $bb_post will have the following objects inside:

$bb_post

post_id

forum_id

topic_id

poster_id

post_text

post_time

poster_ip

post_status

post_position

$topic

topic_id

topic_title

topic_slug

topic_poster

topic_poster_name

topic_last_poster

topic_last_poster_name

topic_start_time

topic_time

forum_id

topic_status

topic_open

topic_last_post_id

topic_sticky

topic_posts

tag_count

You use it like this:

global $topic; echo "$topic->topic_title";

or to answer your original question:

global $bb_post; echo "$bb_post->forum_id";

Of course doing it this way bypasses any filters that may be in place from plugins but that may not matter if you are just trying to do something simple.

Skip to toolbar