• Hi

    Im trying to enrich this notification with subject (post title) and content, rather than its current view and edit links, could anyone help?

    <?php
    
      function __notify_admin_on_publish( $new_status, $old_status, $ticket )
    {
        if ( $new_status != 'publish' || $old_status == 'publish' )
            return;
    
        $message = 'View it: ' . get_permalink( $ticket->ID ) . "\nEdit it: " . get_edit_post_link( $ticket->ID );
        if ( $post_type = get_post_type_object( $ticket->post_type ) )
            wp_mail( get_option( 'admin_email' ), 'New ' . $post_type->labels->singular_name, $message );
    
    }
    add_action( 'transition_post_status', '__notify_admin_on_publish', 10, 3 );
    ?>
  • The topic ‘Email notification’ is closed to new replies.