Tag posts that are published from WordPress to Discourse

wpc_publish_body 필터를 사용하여 이를 구현할 수 있습니다. 예를 들어 다음과 같습니다.

add_filter(  'wpdc_publish_body', function( $body, $remote_post_type, $post_id ) {
   if ( 'create_post' === $remote_post_type ) {
      $body['tags'] = array( 'tag1', 'tag2' );
   }
   return $body;
}, 10, 3);

2.4.5 버전에서는 필터에 post_id를 매개변수로 추가하여, 특정 유형의 게시글에 태그를 추가하는 특정 사례를 더 쉽게 처리할 수 있도록 했습니다.

2개의 좋아요