我正在尝试创建这样的过滤器
add_filter(\'comment_reply_link_args\',\'change_author_title\');
function change_author_title( $args ) {
$defaults = array(
\'add_below\' => \'comment\',
\'respond_id\' => \'respond\',
\'reply_text\' => __( \'Reply\' ),
/* translators: Comment reply button text. %s: Comment author name. */
\'reply_to_text\' => __( \'THIS TEXT\' ),
\'login_text\' => __( \'Log in to Reply\' ),
\'max_depth\' => 0,
\'depth\' => 0,
\'before\' => \'\',
\'after\' => \'\',
);
$args = wp_parse_args( $args, $defaults );
return $args;
}
What i actually need is to filter the \'reply_to_text\' from the $defaults array.
这背后的原因是我用get\\u comment\\u author创建了一个过滤器
add_filter(\'get_comment_author\', \'my_comment_author\', 10, 2);
function my_comment_author( $author, $comment_ID ) {
if (! is_admin()) {
// Get the comment ID from WP_Query
$comment = get_comment( $comment_ID );
$authoremail = get_comment_author_email( $comment);
$user = get_user_by( \'email\', $comment->comment_author_email );
if (! email_exists($authoremail)) {
if(mb_strlen($comment->comment_author, \'UTF-8\')>13){
$author = mb_substr($comment->comment_author,0,13, \'UTF-8\').\'.\'; }
} else {
if( ! empty( $user->first_name ) ){
$author = $user->first_name; }
else {
return $author; }
} }
return $author;
}
我想在$defaults数组“reply\\u to\\u text”中传递相同的输出。
谁能给我小费吗?
非常感谢。