Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbp_forum_get_subforums() returns empty array


  • yurius
    Participant

    @yurius

    I want to list the subforums under the category. My forum structure is like this:
    Category A
    – Subforum1
    – Subforum2
    – Subforum3

    When parent category id is ’90’, I expected to get subforums of category 90.

    $sub_forums[] = bbp_forum_get_subforums(90);
    var_dump($sub_forums);

    This returns empty array. Please let me know if my usage is wrong.

Viewing 5 replies - 1 through 5 (of 5 total)

  • Robin W
    Moderator

    @robin-w

    try

    $sub_forums = bbp_forum_get_subforums(90);
    var_dump($sub_forums);

    yurius
    Participant

    @yurius

    I tried this but result is
    array(0) { }
    It’s still empty.


    Robin W
    Moderator

    @robin-w

    just tried it on my website, and that code works fine.

    3 possibilities

    1. the 90 is wrong
    2. the 90 forum does not have sub forums
    3. some other code is filtering the bbp_forum_get_subforums function

    If you are happy it is not 1 or 2, then it could be a theme or plugin issue

    Themes

    As a test switch to a default theme such as twentyfifteen, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users

    Health Check & Troubleshooting

    Then come back


    yurius
    Participant

    @yurius

    Thank you for clarifying.
    “2. the 90 forum does not have sub forums” was right.
    It was my simple mistake.


    Robin W
    Moderator

    @robin-w

    no problem – glad you are fixed !

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar