In a plugin, I’ve added the action
add_action ('post-new.php', 'set_custom_fields_for_new_posts');
so when the user tries to create a new post, I add it some custom fields.
The problem is that the function add_post_meta takes the post_id parameter and a new post has no id before saving it.
- The topic ‘new post id’ is closed to new replies.