Question

I'm trying to notify admin whenever a post is updated, but only the modified content, primarily the updated metadata.

I haven't come up with anything I really like, but here's the options I see as of now:

1. There's a hook for when a post is published (I'm working with a custom post):

 add_action('new_to_publish_{custom_post_type_name}', 'run_when_post_published');
  • There's functions/hooks to grab revisions, I forget exactly where. Thus I could compare the recently published with previous revision, detect changes, and email accordingly. That would grab universal changes for anything that's been updated. - has anyone worked with functions dealing with post revisions?

2. Add custom buttons that grab the data just added (based on the button used), then activates the publish post function. However, it would be limited to just the metadata I've created, and just the content connected to that button.

Has anyone worked with this before? There has to be something out there, but most I've seen just send a notification without the content, and only the updated content.

Thanks!

Was it helpful?

Solution

I decided that the best way to go was actually just use ajax to save the data dynamically rather than waiting to actually publish/update the post. From there, I would have the user choose what to email based on what was updated and what needed to be sent out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top