Create new WP post from a forum topic
-
Hi,
I need help with something i really have tried to solve on my own.I would like to have a link/button on each of the topics (only the first one under each topic) in bbPress forum. This link should go to “Create New Post” page where the user can generate a new wp post in a specific category. I have same categories for forum topics and posts. Therefore category for the new post should be the same as for the forum topic ($kat_id in the following)
I have this until now, but i dont know how to use $kat_id to get same category for the blog post. I need to assign this $kat_id to the category for the blog post, but how ??
function add_content_before_first_reply_content($content,$id){ $post = get_post($id); $topic_id = bbp_get_topic_id(); $reply_id = bbp_get_reply_id(); $hf_user = wp_get_current_user(); $hf_username = $hf_user->user_login; $kat_id = wp_get_post_parent_id($post); <code>$content_to_add ="<a href="create-new-post?vis=$kat_id"> Add new blog </a>";</code> if ($topic_id === $reply_id) { // do whatever you need to in here $content .= $content_to_add; } return $content; } add_filter( 'bbp_get_reply_content', 'add_content_before_first_reply_content', 99, 2 );
Thanks in advance !!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Create new WP post from a forum topic’ is closed to new replies.