HameThreadは、大掛かりな設定なしにWordPressをスレッド形式のQ&Aフォーラム/サポートデスクに変えます。各トピックはthread投稿として作成され、返信は通常のWordPressコメントとして扱われるため、モデレーション、権限グループ、REST APIについてすでにご存知の知識がそのまま活用できます。
一般的なフォーラムにはない強みがあります:
- WooCommerce商品サポート — 商品ページに「サポートを受ける」ボタンを表示し、購入者からの質問をマイアカウント内でスレッドとして収集します。
- 非公開スレッド — 投稿者、招待されたユーザー、編集者のみが読めるスレッドを開けます。有料サポートや機密性の高いサポートに最適です。
- ベストアンサー — 質問を解決した返信をマークし、スレッド全体を解決済みとしてフラグ付けします。
- ブロックファースト — 任意のページにスレッドボタンブロックを配置するだけで、訪問者がスレッドを開始できます。テンプレート編集もコードも不要です。
機能
topicタクソノミーを持つthread投稿タイプ- AJAX/REST投稿によるコメントベースの返信(ページ全体のリロード不要)
- ベストアンサー&解決済み/未解決ステータス
- 権限チェック付きの非公開スレッド
- 一定期間動きがないスレッドの自動クローズ
- コメントへの評価機能
- スレッド購読者へのメール通知
- SEO向けのJSON-LD(
QAPage)構造化データ - WooCommerceのマイアカウントサポートページと商品ごとのサポートボタン
- 任意の公開投稿タイプでコメントスレッドを有効化可能
- 設定 → ディスカッションの管理画面設定(一般的な調整はコード不要)
カスタマイズ
一般的な設定は設定 → ディスカッションから行えます:
- スレッドの説明
- ユーザーが非公開スレッドを開始できるようにする
- HameThread形式のコメントスレッドを有効にする投稿タイプ
その他の項目もすべてフィルターで変更可能です。下記の開発者向け情報をご覧ください。
開発者向け情報
返信は標準のWordPressコメント、スレッドは標準の投稿タイプなので、コアのフックがそのまま使えます。さらにHameThreadは多くのフィルター/アクションを公開しています。特に便利なものは以下の通りです:
Hook Type Purpose
hamethread_before_thread_form / hamethread_after_thread_form
action
Add markup/fields to the thread form
hamethread_new_thread_post_params
filter
Register extra REST parameters for new threads
hamethread_new_thread_post_arg
filter
Modify the post array before a thread is inserted
hamethread_new_thread_validation
filter
Add validation errors (WP_Error)
hamethread_new_thread_inserted
action
React after a thread is created
hamethread_before_comment_form / hamethread_after_comment_form
action
Add markup/fields to the comment form
hamethread_new_comment_params
filter
Modify comment data before insert
hamethread_default_subscribers / hamethread_subscribers
filter
Control who is notified
hamethread_user_can_start_private_thread
filter
Allow private threads
hamethread_user_can_comment / hamethread_user_can_post
filter
Capability checks
hamethread_dynamic_comment_post_types
filter
Post types that get comment threads
hamethread_post_setting / hamethread_post_type / hamethread_taxonomy
filter
Customize the post type & taxonomy
hamethread_template
filter
Override template parts
例 — スレッドフォームにフィールドを追加して保存する:
// 1. Render the field. add_action( 'hamethread_after_thread_form', function ( $args, $default ) { if ( $args['post'] ) { return; // Only on new threads. } echo ' Notify staff'; }, 10, 2 ); // 2. Register the REST parameter. add_filter( 'hamethread_new_thread_post_params', function ( $params ) { $params['notify_staff'] = [ 'type' => 'integer', 'default' => 0 ]; return $params; } ); // 3. React after the thread is created. add_action( 'hamethread_new_thread_inserted', function ( $post_id, $request ) { if ( $request->get_param( 'notify_staff' ) ) { // notify… } }, 10, 2 );例 — post投稿タイプでコメントスレッドを有効にする:
フックの完全な一覧はソースコードにあります。app/ディレクトリとGitHubリポジトリをご覧ください。
