I don't have much knowledge on php but I'm working with a wordpress theme and would like to auto send an email to the current post author once an action has been done. Right now it only sends an email to the user that is logged in, but I would like the same email to be delivered to the post author as well. In the functions php file there is this code $user = get_userdata($voucher_buyer_id); $to = $user->user_email; So basically my question is, how do I get the post author email? and how to send the email. Thanks
First of, this should have been posted in the WordPress forum. Second, WordPress have pretty good documentation. This is the first hit on a https://developer.wordpress.org/reference/functions/get_the_author_meta/ search: