WordPress hook or X theme hook for saving page

Hi, I’ve written a custom plugin that purges the Cloudflare cache whenever a page or post is saved. This ensures the front-end will always reflect the latest changes.

It works fine with regular WordPress pages/posts created in the WordPress standard editor, but doesn’t seem to fire when I save a page using Cornerstone. The hook I’m triggering on right now is the WordPress “save_post” hook. What hook is Cornerstone using when a page is saved? I want to trigger off that hook as well, but I don’t know what it is.

Hello @geekgoddessx,

Thanks for writing in! We also use save_post when saving the Cornerstone built pages. Moreover, we also have cornerstone_save_post_content that you can use. Kindly let us know if this works with your custom plugin.

Be advised that custom coding is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Best Regards.

Thank you so much! I saw the cornerstone_save_post_content in one of the cornerstone files in the “Save” function (I also saw “cornerstone_save_after_post” I think it was or something similar). I will add that one into the plugin to see if it helps. It seems save_post alone wasn’t triggering it. As a band-aid I told my clients to click the “Update Post” button when returning to the WordPress dashboard after they finished adding/editing a Cornerstone page because the “Update” button definitely triggers it and doesn’t affect anything that Cornerstone did. I appreciate the quick response! :slight_smile:

You are most welcome @geekgoddessx

Hi @geekgoddessx,

I wanted to chime in with a bit more context here.

  • Cornerstone the WordPress wp_update_post function which will fire the WordPress save_post hook.
  • After the post saves, we purge the generated CSS. On the next page load it gets recalculated.
  • The cornerstone_after_save_content hook runs after that CSS is purged.
  • Additionally, all of this happens inside a WP REST API call.

Hopefully this helps fill in any gaps and will help you get the integration working.

Alexander, thank you so much! That definitely fills in some gaps. I was wondering if it was inside a REST API call. I’ll have to do more tweaking. Soooooo appreciate your chiming in on this!

Hi @geekgoddessx,

Glad that we are able to help you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.