I have a custom post type 'report' that is just a title and some content. I want to know if it's possible that when I create a 'report' it creates a discussion post where you'd leave feedback about the 'report'. I'm new to Wordpress dev, and haven't found much info on create two simultaneous post.

I kinda want to do it myself for the learning experience, but if there's a plugin that'd also be cool.

Thanks in advance.


Yes. It is possible publish_report action triggered whenever a report is published, or if it is edited and the status is changed to publish. You have to done some error hadling.

function create_discussion_post( $ID, $post ) {
    //Write a code to create a discussion post.
add_action( 'publish_report', 'create_discussion_post');
| improve this answer | |
  • Ok so I found the documentation for publish_'post-type' after a bit of searching, thanks a lot. However I know it might be a bit noobish, but create_discussion_post is that my own custom function or is it something Wordpress? I can't seem to find it. – KaDane XYZ Jan 13 '17 at 6:30
  • Nvm, create_discussion_post is my own function lol – KaDane XYZ Jan 13 '17 at 6:33
  • Sorry again, what does $ID and $post do in this function? Do they already have a value, or do I give it to them? – KaDane XYZ Jan 13 '17 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.