Reply To: Create a new forum on each new post?
How do I add the post content to the first post of the new topic?
Under this action:
add_action('transition_post_status', 'send_new_post', 10, 3);
Replace with updated function:
// Listen for publishing of a new post
function send_new_post($new_status, $old_status, $post) {
if('publish' === $new_status && 'publish' !== $old_status && $post->post_type === 'post') {
$my_post = array(
'post_title' => $post->ID,
);
$forum_id = bbp_insert_forum($my_post);
$my_topic = array(
'post_title' => $post->post_title,
'post_content' => $post->post_content,
'post_parent' => $forum_id
);
bbp_insert_topic($my_topic);
}
}