Notificación de post pendiente

    Envía un email cuando un post llega con estado pending para que lo revises y publiques si procede.

    <?php
    
    add_action('future_to_publish', 'send_emails_on_new_event');
    add_action('new_to_publish', 'send_emails_on_new_event');
    add_action('draft_to_publish' ,'send_emails_on_new_event');
    add_action('auto-draft_to_publish' ,'send_emails_on_new_event');
    
    
    /**
     * Send emails on event publication
     *
     * @param WP_Post $post
     */
    function send_emails_on_new_event($post)
    {
        $emails = "email_1@mail.com, email_2@mail.com"; //If you want to send to site administrator, use $emails = get_option('admin_email');
        $title = wp_strip_all_tags(get_the_title($post->ID));
        $url = get_permalink($post->ID);
        $message = "Link to post: \n{$url}";
    
        wp_mail($emails, "New post published: {$title}", $message);
    }