Save custom metadata related to draft

I have an action that posts to and I’m currently adding tags to the draft to save the post url when it’s published. I can then use these tags to update the post. While this works it is very fragile, since the tags can be deleted and break this functionality. It also might not be what the users of the action want, by having these extra tags.

I was considering using the FileManager to save the data in a file. But I feel like this would leave extra clutter if the user deletes the draft and this file isn’t cleaned up.

Does anyone have any recommendations for handling this? Am I missing something in the script reference or are these options the only way?

Drafts does not store custom meta data elements, so storing the content as say YAML within the body may be an option. As noted you could store data externally in a file and it is what I tend to do with my own meta data approach - with the same limitation you noted.

There is more about all of this in the following topic.

Overall, I think a strict set of YAML might be your easiest approach.

Hope that helps.

I had not thought of using something like YAML to include what I needed in the body. That would solve the issue of leaving extra files lying around if the draft is deleted.

Thanks for the suggestion. Will have a look at that approach and see how it works. :slightly_smiling_face: