Skip to:

Re: conditionals with is_forum()



To learn how bbPress works, I would suggest browsing the source of the top level files in the bbPress root.

is_forum simply checks the url and does not know which forum it is in

but it can be used before repermalink happens (similar to wordpress)

to get the current forum, in theory you should be able to

global $forum_id;

And then the $forum_id is the current forum number. You can then use the api to get the forum name, etc. if desired.

This may not work in all cases as bbPress has some nasty code in some places that even in 1.0 still does not reset the counter after loops. For example a forum page that has some sub-forums, the $forum_id might very well be the last sub-forum displayed (if the bug has not been fixed yet).

You also cannot fetch $forum_id before repermalink happens which is after bb_init is triggered. Shouldn’t be a problem unless you are trying to execute code while a plugin is loading vs. after init

ps. is_forum is deprecated in 1.0, use bb_is_forum

Skip to toolbar