In functions.php I enqueue comment-reply and also define a callback function for use with wp_list_comments():

function theme_queue_js(){
    if ( 
              ! is_admin() 
           && is_singular() 
           && comments_open() 
           && get_option('thread_comments') 
        wp_enqueue_script( 'comment-reply' );
add_action('wp_print_scripts', 'theme_queue_js');

function simple_comment_format($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment; ?>
    <?php if ( $comment->comment_approved == '1'): ?>
    <li <?php comment_class(); ?>>
            <time><?php comment_date(); ?></time>
            <h4><?php comment_author(); ?></h4>
            <?php comment_text(); ?>
            <?php comment_reply_link(); ?>
    <?php endif;

And in comments.php I've kept things pretty minimal:

<section id="comment-form">
  <?php comment_form() ?>

<?php if ( have_comments() ): ?>
    <section class="commentlist">
<?php endif; ?>

Everything is working ok except that the comment reply links are not showing up for any of the comments. The documentation on modifying comments in general seems really bad! Thanks for any help


You should try to replace

<?php comment_reply_link(); ?>


<?php comment_reply_link( $args ); ?>

and to make sure the $args['depth'] is not zero or greater or equal than the $args['max depth']. There will be no output if that's not the case.

If that doesn't work, you could try to add the comment ID or the comment object as the second input parameter to comment_reply_link( $args, $comment ).

Also check if the comments are open.


If we look at the default callback, we see how the arguments of comment_reply_link() are constructed:

comment_reply_link( array_merge( $args, array(
    'add_below' => $add_below,
    'depth'     => $depth,
    'max_depth' => $args['max_depth'],
    'before'    => '<div class="reply">',
    'after'     => '</div>'
 ) ) );

where we can see how the depth and max_depth are included.

  • <?php comment_reply_link( $args ); ?> and comment_reply_link( $args, $comment ) didn't work for me. Comments are open. Is zero the default depth? In the discussion settings I have set "Enable threaded (nested) comments" to 5 levels deep. What do I need to do to make sure the depth is not zero? – olliew May 11 '16 at 16:29
  • If you call comment_reply_link() without any arguments the default of depth is 0. Try eg. $args['depth'] = 1; above it to test if it shows up then. @olliew – birgire May 11 '16 at 16:45
  • I updated the answer with an example from the default callback, where we can see how the depth is included @olliew – birgire May 11 '16 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.