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.
Related Posts:
- How exactly do automatic updates work?
- What is in media-template.php, and how does it work?
- add_action in namespace not working
- Is it possible to disable a function of a parent theme?
- Variables declared in header not available in other includes
- Create Image Uploader for Widget
- WordPress Ajax always returns a 404 error
- Displaying a variable stored in functions.php inside widget
- Custom Meta Field – Youtube embed
- Failed to open stream / no such file or directory
- Need to get specific data from array
- Use different javascript files for each page on website
- How to get all existing post types
- WooCommerce – Fixed quantity of a product [closed]
- phpMyAdmin displays error when importing database
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- Function set default image when image not present
- How to get the POST TITLE using the POST ID?
- Importing hard coded custom field into acf field
- Displaying the last post on static homepage
- Using foreach loop breaks
- Add child pages of parent to navbar PHP
- From where the header-text can be changed in WordPress custom header?
- Trying to establish connection to External Database
- WordPress plugin for nicer looking slugs? Have multiple pages named the same but they get different slugs
- Showing a different gallery in a seperate post
- How to put “Read more” link in Custom Excerpt inside p tag?
- $wpdb->update with multiple parameters gives error
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- Remove metabox from WordPress menu editor page?
- Improve page speed loading using CDN and async or defer attribute
- Applying A Category to Existing Posts Where Page Title Matches Regex
- Dashboard broken into list of links
- Get users that likes the post
- wordpress visual composer change grid builder post link
- My php header() function is not working [closed]
- PHP array to JS array to use in google map
- My custom get_the_excerpt() can’t get excerpt by ID
- meaning of (array)function()
- deactivating an active plugin using if page
- Single Quotes in .php file doesn’t load website
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Can a page contain php code?
- Last class on last headline?
- Passing the name of selected color from the custom component to `render_callback`
- your php installation be missing the MySQL extension WordPress CPANEL [closed]
- {$key} or $key?
- Display the 3 latest WordPress Posts on a Static Page Outside WordPress
- WordPress mod_rewrite not working on php fpm
- Shortcode to pull posts
- Notice: Trying to get property of non-object
- How do I pull information from one wordpress backend into another? [closed]
- Change Spaces to Dashes?
- How to add videos on my home page slider?
- select a single val though a table in wordpress
- How can I enter on the Thank you page in woocommerce the discount code I assigned to the product category?
- PHP inside echo HTML
- Filter ‘comment_notification_text’ not working
- How do I check if a product is in two categories?
- oceanwp+woo mobile cart sidebar text
- Check if current post in loop is last on current page
- php code for outputting a custom page in my account
- Find out div class
- Add a top bar to a wordpress theme without editing the header.php file?
- Using a PHP form, get the page title or any other element in the sent e-mail
- Custom field in PHP file
- How do I fix Undefined variable using $_POST in function?
- Check the database for a postmeta field
- Random code snippet showing up in browser
- Roots Sage Symfony error when using override from template
- Gutenberg blocks shortcodes compatibility
- Same Server, Same PHP, One Site Doesn’t Work [closed]
- How to echo a PHP code into WooCommerce variation product?
- Get Billing Email from WooCommece Checkout and Pass to Fullstory JS
- Featured Products not showing up in “Featured” area of homepage
- WordPress change post date format from english to japanese
- How can I include tags in wordpress search without a plugin
- Retrieve $_POST data to send to javascript without using localize script
- get_category display only 1
- Search bar for page that searches only particular page IDs
- Auto remove empty values in array
- How to run ajax in WordPress Post?
- if conditional in sidebar plugin Password content shortcode
- Make an array listing custom taxonomy
- Get category id for a custom category and display it in a class
- PHP Call outside class function inside anonymous function
- I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?
- How to call a specific value within the functions.php file?
- WordPress plugin/code to to to next/previous post in same category
- WordPress White Screen Error
- Set post to draft if matching word is found in the post
- Warning: filemtime(): stat failed for wp_
- How to transfer session after being redirected to other page
- Keep users logged in Without Remember Me
- How to use js variable to php in wordpress functions.php
- Display total count of products in orders of a specific order status
- How to sort wordpress posts by selecting a year from a drop down?
- WooCommerce Checkout Cart [closed]
- How can I get values from a custom post type depending on where I click on my SVG map?
- WordPress taxonomy and terms question