# WP Discourse 필터 및 액션

**URL:** https://meta.discourse.org/t/wp-discourse-filters-and-actions/307211
**Category:** Administrators
**Tags:** wordpress
**Created:** [5월 8, 2024, 6:47오전 UTC](https://meta.discourse.org/t/wp-discourse-filters-and-actions/307211 "2024-05-08T06:47:49Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [5월 8, 2024, 6:47오전 UTC](https://meta.discourse.org/t/wp-discourse-filters-and-actions/307211/1 "2024-05-08T06:47:50Z")

</div>

이것들은 [WP Discourse](https://github.com/discourse/wp-discourse) 플러그인이 제공하는 모든 액션과 필터입니다. 예시는 참고용일 뿐입니다. 프로덕션 환경에서 사용하기 전에 자신의 인스턴스에서 예시를 테스트하고 검증해야 합니다.

## 필터

WordPress에서 필터를 사용하는 방법에 대한 일반적인 설명은 아래를 참고하세요.

[https://developer.wordpress.org/plugins/hooks/filters/](https://developer.wordpress.org/plugins/hooks/filters/)

### 게시(Publishing)

[WP Discourse](https://github.com/discourse/wp-discourse) 게시 필터.

#### discourse\_post\_types\_to\_publish

“게시할 게시 유형” 설정의 게시 유형 목록에 표시되는 게시 유형을 필터링합니다. 이 설정은 게시 유형의 Discourse 게시를 활성화하거나 비활성화하지 않습니다.

##### 예시

“post” 유형만 표시:

```php
function filter_post_types( $post_types ) {
  return array( 'post' );
}
add_filter( 'wp_discourse_publish_categories', 'filter_post_types', 10, 1);

```

#### wpdc\_publish\_private\_post

비공개 WordPress 게시물을 Discourse에 게시합니다.

#### 예시

```php
function wpdc_custom_publish_private_post( $publish, $post_id ) {
  return 'private' === get_post_status( $post_id );
}
add_filter( 'wpdc_publish_private_post', 'wpdc_custom_publish_private_post', 10, 2 );

```

[https://meta.discourse.org/t/wp-discourse-wont-publish-private-post/96166/9?u=angus](https://meta.discourse.org/t/wp-discourse-wont-publish-private-post/96166/9?u=angus)

#### wpdc\_publish\_after\_save

특정 게시물을 Discourse에 게시할지 여부.

##### 예시

[https://meta.discourse.org/t/wp-discourse-publish-all-new-posts-to-discourse-not-working/58250/13?u=angus](https://meta.discourse.org/t/wp-discourse-publish-all-new-posts-to-discourse-not-working/58250/13?u=angus)

#### wp\_discourse\_before\_xmlrpc\_publish

특정 게시물을 xmlrpc를 사용하여 Discourse에 게시할지 여부.

##### 예시

제목에 "apples"가 포함된 xmlrpc 게시물은 게시하지 않습니다.

```php
function publish_after_save ( $publish_to_discourse, $post ) {
   return strpos($post->post_title, 'apples') !== false;
}
add_filter( 'wpdc_publish_after_save', 'publish_after_save', 10, 2 );

```

#### wpdc\_publish\_format\_title

Discourse 토픽의 제목을 수정합니다.

##### 예시

[https://meta.discourse.org/t/using-yoast-wpseo-title-as-the-topic-title/106991/2?u=angus](https://meta.discourse.org/t/using-yoast-wpseo-title-as-the-topic-title/106991/2?u=angus)

#### wp\_discourse\_excerpt

Discourse로 전송되는 게시물의 내용을 수정합니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-plugin-tips-and-tricks/50757#deal-with-wordpress-shortcodes-6](https://meta.discourse.org/t/wp-discourse-plugin-tips-and-tricks/50757#deal-with-wordpress-shortcodes-6)

#### wpdc\_publish\_post\_category

게시물이 게시될 카테고리를 변경합니다.

##### 예시

항상 게시물을 Site Feedback 카테고리에 게시합니다.

```php
function wpdc_change_post_category( $category, $post_id ) {
  $categories = WPDiscourse\Utilities\Utilities::get_discourse_categories();
  return array_search("Site Feedback", array_column($categories, 'name'));
}
add_filter( 'wpdc_publish_post_category', 'wpdc_change_post_category' );

```

#### wp\_discourse\_publish\_categories

WordPress 게시물을 생성하거나 편집할 때 [WP Discourse](https://github.com/discourse/wp-discourse) 사이드바의 카테고리 설정에 표시되는 카테고리를 필터링합니다.

##### 예시

Site Feedback 카테고리만 표시:

```php
function filter_categories( $categories ) {
  return array_filter( $categories, function( $category ){
	return $category['name'] === 'Site Feedback';
  });
};
add_filter( 'wp_discourse_publish_categories', 'filter_categories', 10, 1);

```

#### wpdc\_publish\_unlisted

게시된 게시물이 Discourse에서 목록에 표시되지(unlisted) 않도록 결정합니다.

##### 예시

게시물에 “knowledge\_base” WordPress 분류에 “document” 용어가 있는 경우 목록에 표시되지 않게 게시합니다.

```php
function wpdc_unlisted_for_site_feedback( $unlisted, $post, $post_id ) {
  return has_term( "document", "knowledge_base", $post ) || $unlisted;
}
add_filter( 'wpdc_publish_unlisted', 'wpdc_unlisted_for_site_feedback' );

```

#### wpdc\_discourse\_username

Discourse 게시물의 저자로 설정할 Discourse 사용자 이름을 설정합니다.

##### 예시

Discourse에 게시되는 모든 게시물의 저자를 "angus"로 설정합니다.

```php
function wpdc_custom_username( $discourse_username, $author_id ) {
  return 'angus';
}
add_filter( 'wpdc_discourse_username', 'wpdc_custom_username' );

```

#### wpdc\_publish\_body

게시물을 생성하거나 업데이트할 때 전송되는 본문(body)을 수정합니다.

##### 예시

모든 게시물에 `tag1`과 `tag2` 태그를 추가합니다.

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

```

### 설정(Settings)

[WP Discourse](https://github.com/discourse/wp-discourse) 설정 필터.

#### wpdc\_utilities\_options\_array

코드가 설정을 사용하는 시점에 [WP Discourse](https://github.com/discourse/wp-discourse)가 사용하는 모든 설정을 수정합니다.

##### 예시

관리자 패널에 무엇이 입력되었든 Discourse URL을 `https://wordpress.pavilion.tech`로 자동 설정

```php
function filter_network_url_setting( $options) {
  $options["discourse_url"] = "https://wordpress.pavilion.tech";
  return $options;
}
add_filter( 'wpdc_utilities_options_array', 'filter_network_url_setting', 10, 1);

```

#### wpdc\_validate\_site\_\*

멀티사이트 네트워크를 사용할 때 [WP Discourse](https://github.com/discourse/wp-discourse) 네트워크 설정을 필터링합니다. 형식: `wpdc_validate_site_[언더스코어_설정_이름]`

##### 예시

관리자 패널에 무엇이 입력되었든 Discourse URL을 `https://wordpress.pavilion.tech`로 자동 설정

```php
function filter_multisite_network_url_setting( $value ) {
  return "https://wordpress.pavilion.tech";
}
add_filter( 'wpdc_validate_site_url', 'filter_multisite_network_url_setting', 10, 1);

```

#### wpdc\_category\_cache\_minutes

카테고리 목록 캐시 지속 시간. 기본값은 10분입니다.

##### 예시

캐시 기간을 5분으로 변경.

```php
function change_category_cache_minutes( $default ) {
  return 5;
}
add_filter( 'wpdc_category_cache_minutes', 'change_category_cache_minutes', 10, 1);

```

### 댓글(Comments)

WordPress의 Discourse 댓글과 관련된 필터.

#### discourse\_post\_avatar\_template\_size

댓글에서 사용되는 아바타의 크기를 설정합니다. 사용 가능한 크기는 Discourse의 `avatar sizes` 사이트 설정에서 설정됩니다(기본값: `20|25|32|45|60|120`).

##### 예시

```php
function filter_avatar_size( $size ) {
  return 32;
}
add_filter( 'discourse_post_avatar_template_size', 'filter_avatar_size', 10, 1);

```

#### wpdc\_comment\_body

댓글 본문 HTML을 필터링합니다.

##### 예시

[https://meta.discourse.org/t/onebox-looks-horrible-on-discourse-comments-below-wp-post/78364/8?u=angus](https://meta.discourse.org/t/onebox-looks-horrible-on-discourse-comments-below-wp-post/78364/8?u=angus)

#### discourse\_participant\_avatar\_template\_size

참여자 아바타의 크기를 설정합니다(`discourse_post_avatar_template_size`와 동일한 옵션).

##### 예시

```php
function filter_participant_avatar_size( $size ) {
  return 20;
}
add_filter( 'discourse_participant_avatar_template_size', 'filter_participant_avatar_size', 10, 1);

```

#### wpdc\_join\_discussion\_link\_text

토론 참여(Join Discussion) 링크 텍스트를 설정합니다. 텍스트 옵션이 적합하지 않을 경우에만 사용하세요.

##### 예시

[https://meta.discourse.org/t/how-to-link-to-discourse-topics-without-displaying-comments/88486?u=angus](https://meta.discourse.org/t/how-to-link-to-discourse-topics-without-displaying-comments/88486?u=angus)

#### wpdc\_comment\_sync\_period

댓글 동기화 주기를 초 단위로 설정합니다. 기본값은 600(즉, 10분)입니다.

##### 예시

동기화 주기를 5분으로 설정.

```php
function custom_comment_sync_period( $minutes, $post_id ) {
  return 300;
}
add_filter( 'wpdc_comment_sync_period', 'custom_comment_sync_period', 10, 2);

```

#### wpdc\_single\_page\_comment\_number\_sync

일반적인 10분 스케줄(true 반환)로 Discourse 댓글 수를 가져올지, 아니면 더 긴 24시간 스케줄(false 반환)로 가져올지 결정합니다. 주로 아카이브 페이지에 사용되며(`discourse_archive_page_sync_period`를 사용하여 설정할 수도 있음, 아래 참조).

##### 예시

게시물과 프론트 페이지에서는 10분마다, 다른 페이지에서는 24시간마다 댓글 수를 동기화.

```php
function my_namespace_single_page_sync( $single_page, $post_id ) {
    return is_front_page() || is_single( $post_id );
}
add_filter( 'wpdc_single_page_comment_number_sync', 'my_namespace_single_page_sync', 10, 2 );

```

#### discourse\_archive\_page\_sync\_period

아카이브 페이지의 댓글 수 동기화 주기를 초 단위로 설정합니다. 기본값은 `86400`(24시간)입니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-plugin-tips-and-tricks/50757?u=angus](https://meta.discourse.org/t/wp-discourse-plugin-tips-and-tricks/50757?u=angus)

#### wpdc\_load\_comments\_template\_for\_user

[WP Discourse](https://github.com/discourse/wp-discourse) 댓글 템플로트가 특정 사용자에게 로드될지 여부.

##### 예시

ID가 `1`인 사용자에게는 댓글을 로드하지 않습니다.

```php
function load_comment_template_for_user( $load_template, $current_user, $post_id ) {
   return $current_user->ID !== 1;
add_filter( 'wpdc_load_comments_template_for_user', 'load_comment_template_for_user', 10, 3 );

```

#### wpdc\_comments\_count

특정 게시물의 댓글 수를 필터링합니다.

##### 예시

```php
function filter_comments_count( $count, $post_id, $discourse_post_id ) {
  ## 댓글 수 변경
}
add_filter( 'wpdc_comments_count', 'filter_comments_count`, 10, 3 );

```

#### discourse\_replies\_html

댓글의 HTML을 변경합니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus](https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus)

#### discourse\_no\_replies\_html

댓글이 없을 때 표시되는 HTML을 변경합니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus](https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus)

#### discourse\_no\_connection\_html

Discourse에 연결이 없을 때 표시되는 HTML을 변경합니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus](https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus)

#### discourse\_comment\_html

개별 댓글의 HTML을 변경합니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus](https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus)

#### discourse\_participant\_html

참여자(participants)의 HTML을 변경합니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus](https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus)

#### discourse\_publish\_format\_html

Discourse에 게시되는 콘텐츠의 WordPress 게시물 상세 정보의 HTML을 변경합니다.

##### 예시

[https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus](https://meta.discourse.org/t/wp-discourse-template-customization/50754?u=angus)

### [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 제공자(Provider)

[WP Discourse](https://github.com/discourse/wp-discourse) [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 제공자 필터.

#### discourse\_email\_verification

[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)로 로그인할 때 Discourse가 사용자의 이메일을 확인해야 하는지 여부.

##### 예시

사용자의 이메일이 `discourse.org` 도메인이 아닌 경우 이메일 확인을 요구합니다.

```php
function require_email_verification_for_external_domains( $require_activation, $user ) {
   $user_info = get_userdata( $user->ID );
   return strpos( $user_info->user_email, 'discourse.org' ) == false || $require_activation;

}
add_filter( 'discourse_email_verification', 'require_email_verification_for_external_domains`, 10, 2 );

```

#### wpdc\_email\_verification\_not\_verified

이메일 확인 결과가 false일 때 필터링합니다.

##### 예시

사용자의 이메일이 `discourse.org` 도메인인 경우 항상 true 확인 결과를 반환합니다.

```php
function wpdc_custom_email_verification_not_verified( $verified, $user_id) {
   $user_info = get_userdata( $user_id );
   return strpos( $user_info->user_email, 'discourse.org' ) !== false || $verified;
}
add_filter( 'wpdc_email_verification_not_verified', 'wpdc_custom_email_verification_not_verified`, 10, 2 );

```

#### wpdc\_email\_verification\_verified

이메일 확인 결과가 true일 때 필터링합니다.

##### 예시

사용자의 이메일이 `discourse.org` 도메인이 아닌 경우 항상 false 확인 결과를 반환합니다.

```php
function wpdc_custom_email_verification_verified( $verified, $user_id ) {
   $user_info = get_userdata( $user_id );
   return strpos( $user_info->user_email, 'discourse.org' ) !== false || false;
}
add_filter( 'wpdc_email_verification_verified', 'wpdc_custom_email_verification_verified`, 10, 2 );

```

#### wpdc\_sso\_avatar\_url

[DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)로 로그인할 때 Discourse에서 사용자의 아바타 URL을 설정합니다.

##### 예시

[https://meta.discourse.org/t/dont-update-avatar-if-default/118877/4?u=angus](https://meta.discourse.org/t/dont-update-avatar-if-default/118877/4?u=angus)

#### wpdc\_sso\_params

사용자가 로그인할 때 전송되는 [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 매개변수를 변경합니다.

##### 예시

[https://meta.discourse.org/t/managing-discourse-group-membership-with-wp-discourse-sso/74724/81?u=angus](https://meta.discourse.org/t/managing-discourse-group-membership-with-wp-discourse-sso/74724/81?u=angus)

#### wpdc\_bypass\_sync\_sso

사용자의 WordPress 계정이 Discourse 계정과 동기화되는 것을 방지합니다.

##### 예시

[https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234/2?u=angus](https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234/2?u=angus)

#### wp\_new\_user\_notification\_email\_admin

사이트 관리자에게 전송되는 신규 사용자 알림 이메일의 내용을 필터링합니다.

##### 예시

```php
function wp_custom_new_user_notification_email_admin( $email_opts, $user, $blogname ) {
  ## 관리자에게 전송되기 전에 이메일을 수정합니다.
}
add_filter( 'wp_new_user_notification_email_admin', 'wp_custom_new_user_notification_email_admin', 10, 2 );

```

#### wp\_new\_user\_notification\_email

신규 사용자에게 전송되는 신규 사용자 알림 이메일의 내용을 필터링합니다.

##### 예시

```php
function wp_custom_new_user_notification_email( $email_opts, $user, $blogname ) {
  ## 사용자에게 전송되기 전에 이메일을 수정합니다.
}
add_filter( 'wp_new_user_notification_email', 'wp_custom_new_user_notification_email', 10, 2 );

```

### [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 클라이언트(Client)

[WP Discourse](https://github.com/discourse/wp-discourse) [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 클라이언트 필터.

#### wpdc\_sso\_client\_add\_link\_buttons\_on\_profile

WordPress 사용자 프로필에 Discourse 계정 링크 버튼을 표시할지 여부.

##### 예시

```php
function wpdc_dont_add_account_link_button( $add_button ) {
   return false;
}
add_filter( 'wpdc_sso_client_add_link_buttons_on_profile', 'wpdc_dont_add_account_link_button' );

```

#### wpdc\_sso\_client\_updated\_user

WordPress 사용자를 업데이트하기 전에 Discourse 사용자 데이터를 필터링합니다.

##### 예시

사용자 이름의 첫 글자가 대문자인지 확인합니다.

```php
function wpdc_ensure_capitalisation( $updated_user, $query ) {
   $updated_user['name'] = ucfirst( $updated_user['name'] );
   return $updated_user;
}
add_filter( 'wpdc_sso_client_updated_user', 'wpdc_dont_update_admin_users' );

```

#### wpdc\_sso\_client\_redirect\_after\_login

성공적인 로그인 후 사용자를 리디렉션하는 데 사용되는 return\_sso\_url을 필터링합니다.

##### 예시

성공적인 로그인 후 사용자를 항상 "dashboard"로 리디렉션.

```php
function wpdc_always_redirect_to_dashboard( $return_sso_url ) {
   return "/dashboard";
}
add_filter( 'wpdc_sso_client_redirect_after_login', 'wpdc_always_redirect_to_dashboard' );

```

#### wpdc\_sso\_client\_redirect\_after\_failed\_login

실패한 로그인 후 사용자를 리디렉션하는 데 사용되는 login\_url을 필터링합니다.

##### 예시

실패한 로그인 후 사용자를 항상 “help” 페이지로 리디렉션.

```php
function wpdc_always_redirect_to_help( $redirect_url ) {
  return "/help";
}
add_filter('wpdc_sso_client_redirect_after_failed_login', 'wpdc_always_redirect_to_help');

```

#### wpdc\_nonce\_life

nonce 타임아웃을 설정합니다. 기본값은 10분입니다.

##### 예시

nonce 타임아웃을 5분으로 설정.

```php
function wpdc_custom_nonce_life( $nonce_timeout ) {
  return 5;
}
add_filter( 'wpdc_nonce_life', 'wpdc_custom_nonce_life' );

```

#### wpdc\_sso\_client\_login\_anchor

WordPress 로그인 양식에 표시되는 Discourse 로그인 링크에 표시되는 텍스트를 변경합니다.

##### 예시

텍스트를 "Login with your forum account"로 변경.

```php
function wpdc_custom_sso_client_login_anchor ( $login_text ) {
  return "Login with your forum account";
}
add_filter( 'wpdc_sso_client_login_anchor', 'wpdc_custom_sso_client_login_anchor' );

```

#### wpdc\_sso\_client\_login\_button

WordPress 로그인 양식에 표시되는 Discourse 로그인 링크를 변경합니다.

##### 예시

링크 요소를 변경합니다(클래스와 title 속성 추가).

```php
function wpdc_custom_sso_client_login_button( $button, $sso_login_url, $link_options ) {
   return sprintf( '<a class="wpdc-sso-client-login-link" href="%s" class="discourse-login-link" title="%s">%s</a>', esc_url( $sso_login_url ), sanitize_text_field( "Click to login with Discourse" ), sanitize_text_field( "Login with Discourse" ) );
}
add_filter( 'wpdc_sso_client_login_button', 'wpdc_custom_sso_client_login_button', 10, 3 );

```

#### wpdc\_sso\_client\_query

페이지 캐싱 문제를 처리하기 위해 [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)를 초기화하는 쿼리에 임의의 문자열을 추가합니다.

##### 예시

[https://meta.discourse.org/t/wordpress-sso-expired-nonce/105159/15?u=angus](https://meta.discourse.org/t/wordpress-sso-expired-nonce/105159/15?u=angus)

#### wpdc\_sso\_client\_redirect\_url

사용자가 로그인된 후 사용되는 리디렉션 URL을 필터링합니다.

##### 예시

로그인 후 사용자를 대시보드로 리디렉션.

```php
function wpdc_custom_sso_client_redirect_url( $encoded_url, $unencoded_url ) {
  return "/dashboard";
}
add_filter( 'wpdc_sso_client_redirect_url', 'wpdc_custom_sso_client_redirect_url', 10, 2);

```

### 웹훅(Webhooks)

[WP Discourse](https://github.com/discourse/wp-discourse) 웹훅 필터.

#### wpdc\_webhook\_get\_page\_by\_title\_post\_type

WordPress 게시물과 Discourse 게시물을 일치시키는 데 사용되는 게시 유형을 변경합니다. 기본값은 "post"입니다.

```php
function wpdc_match_custom_posts( $post_type ) {
  return 'custom_post_type';
}
add_filter( 'wpdc_webhook_get_page_by_title_post_type', 'wpdc_match_custom_posts' );

```

#### wpdc\_use\_discourse\_user\_webhook

Discourse 사용자 웹훅을 사용할지 여부.

##### 예시

[https://meta.discourse.org/t/cannot-connect-wp-discourse-to-discourse-forum/51119/20?u=angus](https://meta.discourse.org/t/cannot-connect-wp-discourse-to-discourse-forum/51119/20?u=angus)

### 유틸리티(Utilities)

[WP Discourse](https://github.com/discourse/wp-discourse) 유틸리티와 함께 사용할 수 있는 필터.

#### wpdc\_auto\_create\_user\_require\_activation

유틸리티 `create_discourse_user`에 의해 생성된 사용자가 활성화(activation)를 필요로 하는 시점을 결정합니다.

##### 예시

[https://meta.discourse.org/t/wp-membermouse-discourse-integration-guide/79636?u=angus](https://meta.discourse.org/t/wp-membermouse-discourse-integration-guide/79636?u=angus)

## 액션(Actions)

WordPress에서 액션을 사용하는 방법에 대한 일반적인 설명은 아래를 참고하세요.

[https://developer.wordpress.org/plugins/hooks/actions/](https://developer.wordpress.org/plugins/hooks/actions/)

### 설정(Settings)

[WP Discourse](https://github.com/discourse/wp-discourse) 설정 액션.

#### wpdc\_options\_page\_append\_settings\_tabs

[WP Discourse](https://github.com/discourse/wp-discourse) 설정 탭에 하위 탭을 추가하는 데 사용할 수 있습니다.

##### 예시

```php
function my_wp_discourse_setting_tab( $tab, $parent ) {
   ## 탭을 추가합니다.
}
add_action('wpdc_options_page_append_settings_tabs', 'my_wp_discourse_setting_tab', 10, 2);

```

#### wpdc\_options\_page\_after\_settings\_tabs

설정 탭 이후에 호출됩니다.

##### 예시

```php
function my_custom_wpdc_tab( $tab, $parent ) {
   ## 사용자 정의 탭 코드를 실행합니다.
}
add_action( 'wpdc_options_page_after_settings_tabs', 'my_custom_wpdc_tab', 10, 2 );

```

#### wpdc\_options\_page\_after\_tab\_switch

[WP Discourse](https://github.com/discourse/wp-discourse) 탭이 전환된 후에 호출됩니다.

##### 예시

```php
function my_custom_wpdc_tab_switch( $tab ) {
   ## 탭 전환 후 사용자 정의 코드를 실행합니다.
}
add_action( 'wpdc_options_page_after_tab_switch', 'my_custom_wpdc_tab_switch' );

```

#### wpdc\_options\_page\_after\_form

[WP Discourse](https://github.com/discourse/wp-discourse) 설정 양식이 렌더링된 후에 호출됩니다.

##### 예시

```php
function my_custom_wpdc_options_page_after_form( $tab ) {
   ## 설정이 렌더링된 후 사용자 정의 코드를 실행합니다.
}
add_action( 'wpdc_options_page_after_form', 'my_custom_wpdc_options_page_after_form' );

```

### 댓글(Comments)

[WP Discourse](https://github.com/discourse/wp-discourse) 댓글 액션.

#### wp\_discourse\_after\_comments

댓글이 동기화된 후에 실행됩니다.

##### 예시

```php
function my_custom_comment_handling( $topic_id ) {
   ## 댓글이 동기화된 후 사용자 정의 코드를 실행합니다.
}
add_action( 'wp_discourse_after_comments', 'my_custom_comment_handling' );

```

### [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 제공자(Provider)

[WP Discourse](https://github.com/discourse/wp-discourse) [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 제공자 액션.

#### wpdc\_after\_sync\_sso

사용자가 [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true)를 통해 동기화된 후에 실행됩니다.

##### 예시

[https://meta.discourse.org/t/accessing-discourse-user-avatar-in-wp-functions-php/95390/5?u=angus](https://meta.discourse.org/t/accessing-discourse-user-avatar-in-wp-functions-php/95390/5?u=angus)

#### wpdc\_sso\_provider\_before\_create\_user

Discourse 사용자가 생성되기 전에 실행됩니다.

##### 예시

```php
function my_custom_user_handling( $user_login, $user ) {
   ## 사용자가 생성되기 전에 사용자 정의 코드를 실행합니다.
}
add_action( 'wpdc_sso_provider_before_create_user', 'my_custom_user_handling', 10, 2 );

```

#### wpdc\_sso\_before\_login\_redirect

사용자가 WordPress 로그인으로 리디렉션되기 전에 실행됩니다.

##### 예시

```php
function my_custom_login_handling( $user_login, $user ) {
   ## 사용자가 로그인으로 리디렉션되기 전에 사용자 정의 코드를 실행합니다.
}
add_action( 'wpdc_sso_before_login_redirect', 'my_custom_login_handling', 10, 2 );

```

#### wpdc\_sso\_provider\_before\_sso\_redirect

WordPress 로그인 후 사용자가 Discourse로 리디렉션되기 전에 실행됩니다.

##### 예시

[https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234/2?u=angus](https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234/2?u=angus)

### [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 클라이언트(Client)

[WP Discourse](https://github.com/discourse/wp-discourse) [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) 클라이언트 액션.

#### wpdc\_sso\_client\_after\_login\_link

Discourse 로그인 링크가 렌더링된 후에 실행됩니다.

##### 예시

```php
function my_custom_login_html() {
   ## 사용자 정의 HTML을 추가합니다.
}
add_action( 'wpdc_sso_client_after_login_link', 'my_custom_login_html' );

```

#### wpdc\_sso\_client\_after\_create\_user

WordPress 사용자가 생성된 후에 실행됩니다.

##### 예시

```php
function wpdc_modify_wordpress_user( $user_id ) {
   ## WordPress 사용자를 수정합니다.
}
add_action( 'wpdc_sso_client_after_create_user', 'wpdc_modify_wordpress_user' );

```

#### wpdc\_after\_sso\_client\_user\_update

WordPress 사용자가 업데이트된 후에 실행됩니다.

##### 예시

```php
function wpdc_modify_wordpress_user_after_update( $user_id, $query ) {
   ## WordPress 사용자를 수정합니다.
}
add_action( 'wpdc_after_sso_client_user_update', 'wpdc_modify_wordpress_user_after_update' );

```

### 웹훅(Webhooks)

[WP Discourse](https://github.com/discourse/wp-discourse) 웹훅 액션.

#### wpdc\_before\_webhook\_post\_update

Discourse에서 수신된 업데이트 토픽 웹훅 데이터가 처리되기 전에 실행됩니다.

##### 예시

```php
function wpdc_before_webhook_post_update_changes( $json ) {
   ## Discourse에서 수신된 JSON을 사용합니다.
}
add_action( 'wpdc_before_webhook_post_update', 'wpdc_modify_wordpress_user_after_update' );

```

#### wpdc\_webhook\_after\_get\_page\_by\_title

업데이트 토픽 웹훅에 대해 게시물이 제목으로 일치된 후에 실행됩니다.

##### 예시

```php
function wpdc_webhook_custom_after_get_page_by_title( $title ) {
  ## 일치된 제목으로 무언가를 수행합니다.
}
add_action( 'wpdc_webhook_after_get_page_by_title', 'wpdc_webhook_custom_after_get_page_by_title' );

```

#### wpdc\_webhook\_user\_created

사용자 업데이트 웹훅에 의해 사용자가 생성된 후에 실행됩니다.

##### 예시

```php
function wpdc_webhook_user_created_action( $discourse_user ) {
  ## Discourse 사용자로 무언가를 수행합니다.
}
add_action( 'wpdc_webhook_user_created', 'wpdc_webhook_user_created_action' );

```

#### wpdc\_webhook\_user\_updated

사용자 업데이트 웹훅에 의해 사용자가 업데이트된 후에 실행됩니다.

##### 예시

```php
function wpdc_webhook_user_updated_action( $discourse_user ) {
  ## Discourse 사용자로 무언가를 수행합니다.
}
add_action( 'wpdc_webhook_user_updated', 'wpdc_webhook_user_updated_action' );

```

#### wpdc\_webhook\_before\_update\_user\_data

사용자 업데이트 웹훅에 의해 Discourse 사용자 데이터에서 WordPress 사용자 데이터가 업데이트되기 전에 실행됩니다.

##### 예시

```php
function wpdc_webhook_before_update_user_data_action( $wordpress_user, $discourse_user, $event_type ) {
  ## WordPress 또는 Discourse 사용자로 무언가를 수행합니다.
}
add_action( 'wpdc_webhook_before_update_user_data', 'wpdc_webhook_before_update_user_data_action' );

```

---

_[View the full topic](https://meta.discourse.org/t/wp-discourse-filters-and-actions/307211)._
