I want to send notification email contained last 5 recent posts to subscriber's emails.

Is there any way to count the number of publish_post action hook fired then send the email to receivers?

  • 3
    Counting publish_post would be a bad way to do this, because each time it fires isn't necessarily a new post being published. You'd be better off keeping track of the last post that was emailed and when 5 posts have been made since then send a new email. – Jacob Peattie May 27 '18 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.