Please or Register to create posts and topics.

Hook to get ID/link of automatic topic (post generated)

Hi there,

I am looking for a hook, that fires after a topic was generated by saving a post and allows me to get the ID or a permalink to that topic.

Background:

For a team, I created a custom post type “Tasks” to create tasks with some additional ACF fields. In case a specific task needs further discussion, I added the Asgaros topic_metabox to that post type. Since the forum is used anyway by the team, I do not want to mix WP comments and forum conversations in the same environment, all discussion is handled inside the forum.

I already filter the topic content, to add a link to the specific task (custom post type) in the new forum topic. So whenever a topic is created by creating a task, this topic will contain a link to the specific task.

Additionally I want to add a link back to that forum topic to the specific task. So, what I need, is the ID or something unique right after the topic was created and add that information to the corresponding post.

Since I could not find a documentation of what each hook is really doing, I am posting this question here. I played around with asgarosforum_after_add_topic_submit and asgarosforum_after_post_message already, but could not find a solution.

Any ideas?

Hello @wapsolutions

The asgarosforum_after_add_topic_submit-hook is exactly what it needs. It comes with multiple arguments – including the topic-ID – in the following order:

  • post-ID
  • topic-ID
  • subject
  • content
  • link
  • author-ID
If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!