add attribute before saving a post

Normally you would use the save_post hook, but this runs immediately after the post is created/updated. Why does the save have to happen before?

hello,

after some research following your message, I discover for each new post, an instance is saved. It is possible to access the object with the save_post hook. I added a private $pid attribute to my class. it is fed via save_post.
It is a solution to my problem.
Are there any best practices?
I pass the request in resolved.

thank you



Source link