I'm using the following to send an email to the admin when a post is publish by an author:
add_action('publish_post', 'send_admin_email'); function send_admin_email($post_id){
$to = '[email protected]';
$subject = 'subject';
$message = "Here is :".get_permalink($post_id);
wp_mail($to, $subject, $message );
I would like to add the post author in $message
.
I try get_the_author();
and the_author();
but nothing happens.