wp_insert_post(), Creating a sticky topic with forum parent parent.
I’m writing a theme function which automatically creates a discussion forum for a post on publish. I can create a forum and a topic, but linking the two has proven difficult. Here is what I have:
$forum_topic = array( 'post_title' => $post->post_title . ' - test. ', 'post_content' => $post->post_title . ' test', 'post_name' => $post->post_title . 'test', 'post_status' => 'publish', 'post_parent' => $created_forum_id, 'post_type' => 'topic', ); $posted_topic_id = wp_insert_post($forum_topic);
Then, making it sticky, this is what I’ve attempted:
`update_post_meta( $created_forum_id, ‘_bbp_sticky_topics’, array($posted_topic_id) );`
Both the forum and topic are created, but the parent and sticky are not assigned. How can I do this?
- You must be logged in to reply to this topic.