Tag posts that are published from WordPress to Discourse

Posts can now be tagged when they are published with the WP Discourse plugin. To tag a post, click on the Discourse meta box Advanced Options link to expand the meta box. Add tags to the Tag input, either one at a time, or as a comma separated list.

Any spaces in tag names will be converted to hyphens. The maximum number of tags is set by the ‘Maximum Number of Tags’ option found on the Publishing Settings tab. The maximum number of tags will default to 5 if the setting is left empty. Tags that are not allowed on Discourse due to Site Setting or category restrictions will be omitted when the post is published to Discourse.

7개의 좋아요

특정 커스텀 포스트 유형에 특정 태그를 미리 입력하도록 이 기능을 훅(hook)할 수 있는 방법이 있나요?

1개의 좋아요

WP Discourse 플러그인에는 게시물이 Discourse에 게시되기 전에 태그를 자동으로 추가할 수 있는 훅이 없습니다. 이 용도로 사용할 수 있는 훅을 추가하고, 완료되면 알려드리겠습니다.

4개의 좋아요

이렇게 오래된 글을 건드려서 죄송하지만, 이 기능이 추가되었나요? 소스 코드를 찾아보았지만 아무것도 찾을 수 없었습니다.

2개의 좋아요

아직 해당 훅을 추가하지 않았습니다. 다음 릴리스에 추가하겠습니다 :+1:

2개의 좋아요

2년이 다 됐네요 :open_mouth: 이미 오래전에 추가됐어야 했어요 :laughing:

아니 농담이에요, 미리 감사드립니다 :slight_smile: :+1:

1개의 좋아요

안녕하세요, 새로운 릴리스가 생성된 것을 확인했습니다. 이 기능이 추가된 건가요?

아니요, 해당 릴리스는 다른 특정 문제를 다루었습니다. 다음 릴리스에 포함되도록 하겠습니다.

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개의 좋아요