万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
テンプレートタグ/comment author url
コメント作成者のウェブサイト URL を、リンクを付けずに表示します。
表示する代わりに値として取得するには get_comment_author_url() を使ってください。
作成者(ユーザー)がウェブサイトを設定していない場合は、代わりに現在のページ(投稿など)の URL を表示します。ただし、その場合 get_comment_author_url() は空文字列を返します。
使い方
<?php comment_author_url( $comment_ID ); ?>
パラメータ
- $comment_ID
- (整数) (オプション) 作成者のウェブサイト URL を表示するコメントのID
- 初期値: 0 (現在のコメント)
戻り値
このテンプレートタグは値を返しません。
用例
コメント作成者の名前をリンクとして表示し、リンク先をコメント作成者のウェブサイト URL にします。
<a href="<?php comment_author_url(); ?>"><?php comment_author(); ?> のサイトへ行く</a>
この例は次のような HTML を表示します。
フィルター
コメント作成者のウェブサイト URL を表示する前に apply_filters() を使って 'comment_url'
フィルターフックを呼び出します。
変更履歴
- 0.71 : 新規導入。
ソースファイル
comment_author_url()
は 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/comment_author_url (最新版との差分)