万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
関数リファレンス/get comment text
コメント本文の内容を取得します。取得する代わりに表示するには comment_text() を使ってください。
使い方
<?php get_comment_text( $comment_ID, $args ) ?>
パラメータ
- $comment_ID
- (整数) (オプション) 本文の内容を取得するコメントの ID
- 初期値:
0
(現在のコメント)
- 初期値:
- $args
- (配列) (オプション)
'get_comment_text'
フィルターフックへ渡すパラメータ。- 初期値:
空の配列
- 初期値:
戻り値
- (文字列)
- コメント本文の内容。
用例
<?php $current_comment = get_comment_text(); ?>
参考
- apply_filters() を使って、コメント本文を表示する前に
'get_comment_text'
フィルターフックを呼び出します。パラメータは、コメント本文、コメントのオブジェクト、$args
です。 - コメントのオブジェクトを取得するために get_comment() /en を使用します。
変更履歴
- 1.5.0 : 新規導入。
ソースファイル
get_comment_text() は wp-includes/comment-template.php
内にあります。
関連資料
コメント関数: cancel_comment_reply_link(), comment_author(), comment_author_email(), comment_author_email_link(), comment_author_IP(), comment_author_link(), comment_author_rss(), comment_author_url(), comment_author_url_link(), comment_class(), comment_date(), comment_excerpt(), comment_form_title(), comment_form(), comment_ID(), comment_id_fields() / en, comment_reply_link(), comment_text(), comment_text_rss(), comment_time(), comment_type(), comments_link, comments_number(), comments_open(), comments_popup_link(), comments_popup_script(), comments_rss_link(), get_avatar(), next_comments_link(), paginate_comments_links(), permalink_comments_rss(), previous_comments_link(), wp_list_comments()
最新英語版: WordPress Codex » Function Reference/get_comment_text (最新版との差分)