• Resolved vincentavct

    (@vincentavct)


    Hello,

    I am working on a theme. some fields use autocompletion and I save the results in a custom table. Is there a good practice to temporarily save this data before saving the post. Otherwise it would be necessary to add these attributes after saving the publication.

    thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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?

    Thread Starter vincentavct

    (@vincentavct)

    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add attribute before saving a post’ is closed to new replies.