How to remove or replace the log-in link for comment replies?

You can filter the output for the comment reply link on … wait for it! … 'comment_reply_link'. Just do the same checks as the core function but return something else, in your case: nothing.

<?php # -*- coding: utf-8 -*-
/**
 * Plugin Name: T5 No Comment Log In Link
 * Plugin URI:  http://wordpress.stackexchange.com/q/52350/73
 * Description: Removes the log-in link for comment reply links.
 * Version:     2012.05.16
 * Author:      Thomas Scholz <[email protected]>
 * Author URI:  http://toscho.de
 * License:     MIT
 * License URI: http://www.opensource.org/licenses/mit-license.php
 */

if ( ! function_exists( 't5_do_not_ask_for_comment_log_in' ) )
{
    add_filter( 'comment_reply_link', 't5_do_not_ask_for_comment_log_in' );

    /**
     * Replaces the log-in link with an empty string.
     *
     * @param  string $link
     * @return string
     */
    function t5_do_not_ask_for_comment_log_in( $link )
    {
        if ( empty ( $GLOBALS['user_ID'] ) && get_option( 'comment_registration' ) )
        {
            return '';
        }

        return $link;
    }
}

Leave a Comment