Opened 2 years ago
Last modified 5 months ago
#58604 new defect (bug)
title_reply_to Value of comment_form() Function Isn't Working
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | major | Version: | 6.2.2 |
| Component: | Comments | Keywords: | reporter-feedback |
| Focuses: | Cc: |
Description
Hello everyone, friends;
I encountered a problem when customizing the comment form. If I add the title_reply_to value to the comment_form() function, get the reply_to_text value in the get_comment_reply_link() function.
Has anyone had this problem before? Or am I experiencing this problem due to an error?
<?php $fields = array( 'author' => '...', ); $args = array( 'title_reply' => __('Leave a Reply', 'xxx'), // This value works 'title_reply_to' => __('Leave a Reply to %s', 'xxx'), // This value doesn't work 'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title"><i></i>', // The problem is when I add an icon to this value 'title_reply_after' => '</h2>', 'fields' => apply_filters('comment_form_default_fields', $fields) ); comment_form($args);
Change History (3)
#3
@
5 months ago
Same here, ATM I use this
<?php // Personalizza titolo e link del modulo commenti in WordPress add_filter('comment_form_defaults', function($defaults) { $defaults['title_reply'] = 'Aggiungi un commento 👍'; $defaults['title_reply_before'] = '<h2 id="reply-title" class="comment-reply-title">'; $defaults['title_reply_after'] = '</h2>'; return $defaults; }); // Modifica il link "Rispondi" con @Nome, anche nel data-replyto e aria-label add_filter('comment_reply_link', function ($link, $args, $comment, $post) { $author = get_comment_author($comment); $mention = esc_html('@' . $author); // Sostituisce: testo visibile, data-replyto e aria-label $link = preg_replace('/>[^<]+</', '>' . $mention . '<', $link); $link = preg_replace('/data-replyto="[^"]+"/', 'data-replyto="' . $mention . '"', $link); $link = preg_replace('/aria-label="[^"]+"/', 'aria-label="' . $mention . '"', $link); return $link; }, 10, 4);
And work as expected. Idk why title_reply_to not work at all.
WP 6.8.2, Theme twenty twenty five.
Note: See
TracTickets for help on using
tickets.
Now, I've encountered this issue too. I am using WordPress 6.4.2.