Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

There's no hook for "give me a post ID before the post has been created". You only get an ID after the post has been saved. So yes, use the hook 'content_save_pre' to modify your content before saving, then once you get back a post ID use that ID to update the post featured image.

There's a great answer describing how to acquire and set the image for a post, herehere

And, the hook you'd use to trigger that set image routine would be 'save_post' which is documented here

There's no hook for "give me a post ID before the post has been created". You only get an ID after the post has been saved. So yes, use the hook 'content_save_pre' to modify your content before saving, then once you get back a post ID use that ID to update the post featured image.

There's a great answer describing how to acquire and set the image for a post, here

And, the hook you'd use to trigger that set image routine would be 'save_post' which is documented here

There's no hook for "give me a post ID before the post has been created". You only get an ID after the post has been saved. So yes, use the hook 'content_save_pre' to modify your content before saving, then once you get back a post ID use that ID to update the post featured image.

There's a great answer describing how to acquire and set the image for a post, here

And, the hook you'd use to trigger that set image routine would be 'save_post' which is documented here

Source Link
C C
  • 2k
  • 18
  • 31

There's no hook for "give me a post ID before the post has been created". You only get an ID after the post has been saved. So yes, use the hook 'content_save_pre' to modify your content before saving, then once you get back a post ID use that ID to update the post featured image.

There's a great answer describing how to acquire and set the image for a post, here

And, the hook you'd use to trigger that set image routine would be 'save_post' which is documented here