Skip to main content
  • Engineering

WordPress: How to trigger the Post publish event

These days I’m working on a news publishing app, focused on its back-end API. Now that we’re in the final stage of development, we’ve started adding push notifications, so I needed a way to trigger an event the moment a WordPress post is published, in order to send push notifications to Android and iOS devices. While experimenting with WordPress functions, I came up with this solution, which is handy, and I believe it’ll be useful for anyone wanting to build a similar feature.

By the way, if you know a better way to handle this, please let me know. Improvements are always welcome for apps dealing with millions of users, right?

You can find the gist at https://gist.github.com/yoosuf/3890f3789754afe65525.

  • WordPress
  • WordPress Hooks
  • PHP
  • Automation