Dynamically pull the correct email address from a match

Who should retrieve an email? The hook ‘publish_post’ is triggered when an author puiblish a post. So current user == post author.

I assume you would do that: If Buddy-A publish a post and Buddy-B is logged in at the same time, than Buddy-B should retrieve an email that Buddy-A published a post (which maybe interrest Buddy-B).

If I hit the nail and this is it what you want to do, forget it. WordPress have no centralized user management. You need a plugin ( see List of logged in users ) to get a list of all users currently logged in. Call your function for every user in the list and check if a interest match a post tag.

error code: 523