I have a website which the post's contents are dynamically generated AFTER a post is published.
I'm using this code to generate the content i want:
add_action( 'publish_post', 'generate_content');
//some code here
This process can sometimes take up to 5 minutes, while the post is instantly published (I already set the php timeout to 600 seconds).
I want to schedule the post for when the function has finished it's task, or to save the post as draft and automatically publish it when it's ready.
Is there a way to achieve this? Any help is appreciated.