Getting post id from wp_insert_post_data function?


I’m trying to use the function get_the_tags() from outside the ‘loop’.
I understand this can be achieved by using the post ID like get_the_tags($postID). Does anyone know how I can get the post ID from inside a wp_insert_post_data function?

I’ve tried using 'guid' which is suggested here, although I’ve had no luck. I’m also not sure that’s even the post ID. Any help with this will be appriciated. Thanks.

Here’s the code I’m working with:

function changePost($data, $postarr) {

  $postid = $postarr["ID"];
  $posttags = $postarr['tags_input']; // This doesn't work.

  $content = $data['post_content'];
  $subject = $data['post_title'];
  if($data['post_status'] == 'publish') {
    sendviaemail($content, $subject, $postid, $posttags);

return $data;


As you can see, I want to send the post ID, post tags, content and the subject to another function called sendviaemail. Everything is okay, except I don’t know how to get the tags from the post.

, , Joey Morani 12 years 2011-08-05T09:53:27-05:00 0 Answers 88 views 0

Leave an answer