i am trying to create a filter like this
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.
The reason behind this is that i created a filter with get_comment_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;
}
and i would like to pass the same output in $defaults array 'reply_to_text'.
Could someone give me a tip?
Thank you