Getting content from $post when publishing post
-
I’m trying to get the post content from the global $post variable when a user publishes a new post. The problem I’m encountering is that the hook’s I tried using for this (transition_post_status and publish_post) seem to run before the post is inserted into the database.
This results in an empty string when I try to read data from $post, as (I assume?) this variable is fetched from the DB, but nothing is yet stored in the DB (as a new post is applicable, and said post has not yet been saved).
Is there a hook that fires after a post’s status is transitioned? Alternatively, is it possible to somehow get the post title and content from the TinyMCE editor?!
Would appreciate any help!
- The topic ‘Getting content from $post when publishing post’ is closed to new replies.