Wordpressのadd_filter、apply_filter周りの勉強をしております。
以下のソースコードにapply_filterが出てきますが、第一引数の「get_comment_author」が
自身が記述されている関数のような気がするんですが、この場合は、get_comment_author関数に第二引数以降の引数を渡して処理することになるのでしょうか?
それともどこか別の場所にadd_filter('get_comment_author',hoge)のような記述があり、そちらに引数を渡す処理になるのでしょうか?
php
1function get_comment_author( $comment_ID = 0 ) { 2 $comment = get_comment( $comment_ID ); 3 4 if ( empty( $comment->comment_author ) ) { 5 if ( $comment->user_id && $user = get_userdata( $comment->user_id ) ) 6 $author = $user->display_name; 7 else 8 $author = __('Anonymous'); 9 } else { 10 $author = $comment->comment_author; 11 } 12 13 /** 14 * Filters the returned comment author name. 15 * 16 * @since 1.5.0 17 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 18 * 19 * @param string $author The comment author's username. 20 * @param int $comment_ID The comment ID. 21 * @param WP_Comment $comment The comment object. 22 */ 23 return apply_filters( 'get_comment_author', $author, $comment->comment_ID, $comment ); 24}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/09/25 14:34
2016/09/25 14:59
2016/09/26 14:03