https://kpopnewshub.com/enhypens-ni-kis-reacts-to-mention-of-heeseung-despite-companys-alleged-restrictions/?fsp_sid=19396
🆕 New at EU TechStack: Mention [🇫🇷]
Mention, a Paris-based tool, offers media monitoring, social listening and reputation management for brands to track conversations and make informed decisions.
Simple, reliable monitoring with a solid European footprint.
🔗 Tool page: https://eutechstack.eu/tool/mention
👉 Explore more: https://eutechstack.eu
スレッド内の全てのアカウントに通知が届くのを避けるため、コメント本文にメンションがないアカウントには通知を送らないようにするコードが作れそうだが、そうすると直接の返信でメンションがない場合にも通知が届かなくなるから、却下。
@hitorinezumi ひとりネズミさん、
通知が届くかテスト返信。a@Aの返信x7
a@Aの返信x5への返信。
fedibirdのアカウントにだけメンション。
スレッドに複数のアカウント。
通知の届く先を確認する。
「// 4. 解析結果を反映」のコードを修正した。
単純な上書きだと、tag配列に入っていた{"type":"Mention","href":"~(アカウントのURL)","name":"~(アカウント)"}を消してしまい、通知が届かなくなるので、#メンション が入っているか空のtagの後ろに、ピックアップした #ハッシュタグ のtagを追加するようにした。
修正前:
// 4. 解析結果を反映(空の場合も含めて上書きする)$array['tag'] = array_values( $new_tags );$formatted_content = wpautop( $updated_content );$array['content'] = str_replace( array( "\r\n", "\r", "\n" ), '', $formatted_content );修正後:
// 4. 解析結果を反映// 既存のタグ配列を取得し、今回抽出した新しいタグを末尾に追加する$existing_tags = ( isset( $array['tag'] ) && is_array( $array['tag'] ) ) ? $array['tag'] : array();$array['tag'] = array_merge( $existing_tags, array_values( $new_tags ) );// 本文の整形:wpautopで段落と改行を付与し、二重改行の原因となる \n を除去$formatted_content = wpautop( $updated_content );$array['content'] = str_replace( array( "\r\n", "\r", "\n" ), '', $formatted_content );