【问题标题】:Create New topic in Fourms in bbpress WordPress [closed]在 bbpress WordPress 中的 Fourms 中创建新主题 [关闭]
【发布时间】:2015-01-14 05:08:24
【问题描述】:

我想在 bbpress WordPress 中使用代码/以编程方式创建新主题。我搜索但没有找到任何相关代码。任何人都可以通过提供任何相关的帮助来帮助我。谢谢

【问题讨论】:

    标签: php wordpress buddypress bbpress


    【解决方案1】:

    试试这些功能:

     bbp_insert_topic(), bbp_insert_forum(), and bbp_stick_topic()
    

    详情可以这样试试:

    $topic_data = apply_filters( 'bbp_new_topic_pre_insert', array(
            'post_author'    => $topic_author,
            'post_title'     => $topic_title,
            'post_content'   => $topic_content,
            'post_status'    => $topic_status,
            'post_parent'    => $forum_id,
            'post_type'      => bbp_get_topic_post_type(),
            'tax_input'      => $terms,
            'comment_status' => 'closed'
        ) );
    
        // Insert topic
        $topic_id = wp_insert_post( $topic_data );
    

    您也可以在plugin/bbpress/includes/funcion.php页面找到此代码。希望这可以帮助您

    【讨论】:

    • 非常感谢。我会详细检查这些。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-23
    • 1970-01-01
    • 2014-02-07
    • 2017-04-16
    • 2014-10-16
    • 2014-04-11
    相关资源
    最近更新 更多