[WP Frontend] 포스팅시 등록된 E-mail을 이용 또는 새로 입력하는 방법

2019.02.09: 이 포스팅은 WP 4를 기준으로 만들어졌던 것으로 WP 5에서는 테스트되지 않았습니다.

 

  1. Action Hook을 이용, Hook name을 설정(ex : form_email_hook)
  2. Appearance-Editor 또는 직접 테마의 function.php 파일을 수정
  3. 아래 코드를 추가
    function show_email( $form_id, $post_id, $form_settings ) { 
        if ( $post_id ) {     //포스팅 수정일 경우
            $em = get_post_meta($post_id, '_request_email');
            $value = $em[0];
        }
        else                  //신규 포스팅의 경우
        {
            $current_user = wp_get_current_user();
            $value = $current_user->user_email;
        }
        ?>
        
  4. 서비스 신청에 대한 회신을 받을 e-mail 주소를 입력하세요.

  5.  

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.