Title: comment_reply_link() work wrong
Last modified: October 10, 2023

---

# comment_reply_link() work wrong

 *  Resolved [BlackStar](https://wordpress.org/support/users/blackstar1991/)
 * (@blackstar1991)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/comment_reply_link-work-wrong/)
 * Hi. I find. that method `comment_reply_link()` Work incorect if in admin panel
   you unchecked checkbox `Users must be registered and logged in to comment`
 * ![](https://i0.wp.com/i.ibb.co/yYRzjst/Comments1.jpg?ssl=1)
 * I needed to disable this function because my site uses two versions of the comment
   form, standard form for posts and a custom form.
 *     ```wp-block-code
       <?php
        comment_reply_link(array(
         'reply_text' => __('Reply', 'am'),
         'depth'      => $depth,
         'max_depth'  => $args['max_depth'],
         'login_text' => __('Log in to Reply', 'am'),
         'before' => '',
       ));
       ?>
       ```
   
 * I wrote this connection for a button to reply to a comment, expecting to receive
   a link to log in to leave a comment, but instead Reply continues to be displayed
   to me
 * ![](https://i0.wp.com/i.ibb.co/HzhWQHV/comment2.jpg?ssl=1)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/comment_reply_link-work-wrong/#post-17123069)
 * A login button will only appear if you tick the box you mentioned. But if I understand
   correctly, you want to require login for one comment form but not for the other?
   That is a special case that is not provided for in the function. Or have I understood
   it wrong?
 *  Thread Starter [BlackStar](https://wordpress.org/support/users/blackstar1991/)
 * (@blackstar1991)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/comment_reply_link-work-wrong/#post-17123326)
 * You understand correctly. I have 2 different contact forms on the site and they
   should have different behavior regardless of what function is selected in the
   admin panel
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/comment_reply_link-work-wrong/#post-17123507)
 * The comment_reply_link() function, or actually get_comment_reply_link(), works
   just fine. It is your requirement that is not supported by the function. Within
   the function, it is queried as a condition whether the tick is set – no matter
   how and where it is included. There is obviously no hook or property to influence
   this. And simply changing the label of the button does not change its link target.
 * From my point of view, there is only one possibility. You would have to change
   the value for “comment_registration” before the output where you want the login
   button. Example:
 *     ```wp-block-code
       add_filter( 'option_comment_registration', 'custom_enable_registration' );
   
       function custom_enable_registration() { return true; }
   
       comment_reply_link(array(
         'reply_text' => __('Reply', 'am'),
         'depth'      => $depth,
         'max_depth'  => $args['max_depth'],
         'login_text' => __('Log in to Reply', 'am'),
         'before' => '',
       ));
       remove_filter( 'option_comment_registration', 'custom_enable_registration' );
       ```
   
 * The trick here is that only for the execution of your custom link, the return
   of the setting is changed to force the output of the login link. Afterwards, 
   this is undone so that it does not apply to the rest of the page.
 *  Thread Starter [BlackStar](https://wordpress.org/support/users/blackstar1991/)
 * (@blackstar1991)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/comment_reply_link-work-wrong/#post-17123547)
 * Thanks. That’s what i need.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘comment_reply_link() work wrong’ is closed to new replies.

## Tags

 * [comment_reply_link](https://wordpress.org/support/topic-tag/comment_reply_link/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [BlackStar](https://wordpress.org/support/users/blackstar1991/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/comment_reply_link-work-wrong/#post-17123547)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
