bbp_trash_forum_topics (intforum_id美元

在论坛内丢弃所有主题

描述

参数

forum_id美元

int(必需)

返回

(如果)论坛无效

文件:bp-forums /论坛/显然也

function bbp_trash_forum_topics($forum_id = 0){//验证论坛ID $forum_id = bbp_get_forum_id($forum_id);If(空($forum_id))返回;$post_stati = implode(',', array(bbp_get_public_status_id(), bbp_get_close_status_id (), bbp_get_pending_status_id()));$topics = new WP_Query(array('suppress_filters' => true, 'post_type' => bbp_get_topic_post_type(), 'post_parent' => $forum_id, 'post_status' => $post_stati, 'posts_per_page' => -1, 'nopaging' => true, 'fields' => 'id=>parent'));//循环遍历子主题。Topic回复将被// bbp_trash_topic()操作销毁。if (!empty($topics->posts)){//防止调试注意$pre_trashed_topics = array();wp_trash_post($topic->ID, true); //循环遍历主题,删除它们,并将它们添加到数组foreach ($topic-> posts as $topic) {wp_trash_post($topic->ID, true);美元pre_trashed_topics[] = $主题- > ID;} //设置被此操作销毁的主题的post_meta条目。 // This is so we can possibly untrash them, without untrashing topics // that were purposefully trashed before. update_post_meta( $forum_id, '_bbp_pre_trashed_topics', $pre_trashed_topics ); // Reset the $post global wp_reset_postdata(); } // Cleanup unset( $topics ); }

更新日志

更新日志
版本 描述
bbPress (r3668) 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队