使用bbp_insert_topic创建主题会在两个论坛上显示

时间:2016-02-07 19:29:05

标签: wordpress wordpress-plugin bbpress

这是我的情景,

我创建了一个类型类别的私人论坛,然后我创建了两个公共论坛来键入论坛,这是该类别论坛的孩子。当我点击网址

时,我得到了一个很好的类别组织

主页/论坛/私人:DummyCategory。

但是当我点击其中一个论坛:: Home / Forums / Private:DummyCategory / DummyForum1

所有不属于该论坛的帖子都会显示出来。这意味着如果我在DummyForum2或1或任何论坛中发帖,当我点击Home / Forums / Private:DummyCategory / DummyForum1时,所有帖子都会显示出来。

它不能通过设计?这是一个错误吗?最有可能的一些设置需要在bbpress中改变,我想,任何想法?

仅为了解更多细节,我正在使用代码添加到论坛中。我可以正确显示论坛之间的父子关系,将主题的插入转到正确的父论坛。但随后出现了这个错误。

if (!function_exists('bbp_insert_topic')) {
            require_once '/includes/topics/functions.php';
        }

        echo "All fine here ??? Did it reached ";
        $forum_ID = $selectmyID;
        $terms = array(bbp_get_topic_tag_tax_id() => $key_pieces);
        // The topic data.
        $topic_data = array(
        'post_parent'       => $forum_ID, // forum ID of Projects  hard coded
        'post_status'       => bbp_get_public_status_id(),   // Subscribed users can see this
        'post_content'      => $my_content,
        'post_title'        => $slug,
        'comment_status'    => 'open',
        'menu_order'        => 0,
        'tax_input'         => $terms  
        );

        // The topic meta.
        $topic_meta = array(
        'forum_id'    => $topic_data['post_parent'],
        'reply_count' => 0
        );

        // NOTICE! Understand what this does before running.
        $post_id = bbp_insert_topic($topic_data, $topic_meta);
        bbp_stick_topic($post_id , true);                         // Making it super sticky !


        echo "The post id returned is " . $post_id;
        echo "Sucessfully inserted the post" . $slug . " programmatically !!!!";

1 个答案:

答案 0 :(得分:0)

我得到了答案:我刚从

改变了
 bbp_stick_topic($post_id , true);   // Making it super sticky !

到此:

bbp_stick_topic($post_id , false);   // Making it sticky !

超级粘贴将主题粘贴到每个论坛的顶部,这是问题所在。在bbpress forums上查看我的互动。