Hi Jhon, and thanks for your reply.
The space is an error that I had already solved, in fact the function is correct and run.
But it only works when I update a post, I would like it to work when I create the post instead.
Can you help me ?
Thank you.