Hello,I have a problem, after saving the entry I want to send an email. two email are sent correctly but $friendemail=get_post_meta( $post_id, 'alerta-emails', true ); is emprty.
Thanks
array(
'id' => $prefix . 'emails',
'type' => 'email',
'name' => 'Email',
),
function send_mails_on_publish( $new_status, $old_status, $post_id)
{
$post=get_post($post_id);
if ( 'publish' !== $new_status or 'publish' === $old_status
or 'alertas' !== get_post_type( $post ) )
return;
$friendemail=get_post_meta( $post_id, 'alerta-emails', true );
if( 'true' == get_post_meta( $post_id, 'alerta-emails', true ) )
return;
$author = get_userdata($post->post_author);
$admin= get_bloginfo('admin_email');
$emails = array ($admin, $author->user_email, $friendemail);
$alert = "Detalle". $post->post_title;
wp_mail( $emails, 'Nueva alerta publicada', $alert );
}