Solve WordPress Problems With The save_post Hook
Why does it always happen on a Friday afternoon?
One recent Friday afternoon, we had a panic here at PublishPress.
We made a minor change to one of the options in Easy Digital Downloads – that's the eCommerce plugin we use on this site. Suddenly, all the subscription plans were broken. Whenever anyone tried to login, they couldn't download their purchases. Every account was marked as “invalid”.
We talked with Easy Digital Downloads support and started exchanging ideas. What could have gone wrong? Was there a major site problem?
Friday afternoon became Friday evening and everyone was feeling stressed.
Then we got this email:
We logged into every Easy Digital Downloads product and clicked “Update”.
That did it! Everything was working again.
As a team, we got talking and realized that it wasn't the first time that clicking “Save” or “Update” had saved the day. We had even used it successfully with PublishPress plugins.
Why does this simple trick work?
Because many WordPress plugins, including Easy Digital Downloads, use the “save_post” hook to create or update data.
On Friday, we'd updated one product that was part of a bundle. Yes, we updated the product, but the bundle data wasn't automatically updated. As soon as we edited the bundle and clicked the “Update”, the save_post hook ran and the bundle data was updated.
This probably isn't ideal behavior, and can be confusing for WordPress users. However, if you're seeing errors after a plugin update, or a change to your plugin's settings, try clicking “Save” or “Update”.