Ajax Check Post Status

So basicly you want an ajax method that checks for post changes.

Here’s a great article on WP ajax for front & back-end.

In short you want to do the following:

  • Load the Ajax JS script on the pages you want to show the
    notification popup.
  • Create wp ajax server-side handling, with hook
    wp_ajax_{your_custom_action}. OR use the WP REST API.
  • Check if a post has changed etc, echo result back to ajax js script.
  • If ajax response is ‘new_post’ etc show popup.

I wouldn’t use setinterval. Do the first ajax call on page load, if the ajax response is good, do the next ajax call after X seconds.