Thanks for the quick reply, John. Actually, I solved my problem. The $post_id
var was ‘new_post’ but my filter was being fired after the post had been created and was thus returning the created post ID. I changed the priority to 1 and everything fell into place.
I’m using the pre_save_post
filter because I need to get the values from my fields in order to structure the new post (including meta and tax) and I don’t believe that I could do that with the new_post
argument – unless I’ve missed something.