2014-06-24 1 views
0

나는이 기능을 functions.php에 새 게시물이 게시 될 때 전자 메일을 보내도록했습니다.Wordpress 전자 우편 게시 내용

게시물의 내용을 이메일의 메시지로 추가하려면 어떻게해야합니까?

function authorNotification($post_id) { 

    $to = '[email protected]'; 

    $subject = 'New Post'; 

    $message = $post_id->post_content; 

    $headers = 'Content-type: text/html'; 

    wp_mail($to, $subject, $message, $headers); 
} 
add_action('publish_post', 'authorNotification'); 

답변

1

이 시도 : -

function authorNotification($post_id) { 

    $to = '[email protected]'; 

    $subject = 'New Post'; 

    $post_obj = get_post($post_id); 
    $postcontent = $post_obj->post_content; 

    $message = $postcontent; 

    $headers = 'Content-type: text/html'; 

    wp_mail($to, $subject, $message, $headers); 
} 
add_action('publish_post', 'authorNotification'); 
+0

당신이 워드 프레스에서 뭔가 다른 메일 응용 프로그램에서와 같이 내가 이메일 제목을 변경하는 방법을 알고있다. – ttmt

+0

당신은 wordpress를 의미합니까 @ ?? – Khushboo

+0

다음과 같이 할 수 있습니다 : - /wp-includes/pluggable.php를 열어 wordpress @를 찾고 wordpress를 원하는대로 바꾸십시오. 두 가지가 있습니다. – Khushboo