Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are using not using <code>wp_list_comments</code> but for instance <code>get_comments</code> and then run a for each, as you did above, the problem with <code>comment_reply_link</code> is the following:</p> <p>In the wordpress comment-template.php the <code>get_comment_reply_link</code> used by <code>comment_reply_link</code> has a <code>NULL</code> value in <code>$args['max_depth']</code> thus the below if statement:</p> <pre><code>function get_comment_reply_link($args = array(), $comment = null, $post = null) { $defaults = array( 'add_below' =&gt; 'comment', 'respond_id' =&gt; 'respond', 'reply_text' =&gt; __('Reply'), 'login_text' =&gt; __('Log in to Reply'), 'depth' =&gt; 0, 'before' =&gt; '', 'after' =&gt; '' ); $args = wp_parse_args($args, $defaults); if ( 0 == $args['depth'] || $args['max_depth'] &lt;= $args['depth'] ) return; </code></pre> <p>is always true and the function exits premature. Even if you set <code>'depth' =&gt; 1</code>. Because NULL is always smaller than 0,1,etc.. You can not write a custom filter for <code>comment_reply_link</code> because the hook is called later in the function. </p> <p>The only way around I have found without changing the comment-template.php file was to do the following in my comment.php:</p> <pre><code>$post_id = get_the_ID(); $comment_id =get_comment_ID(); //get the setting configured in the admin panel under settings discussions "Enable threaded (nested) comments levels deep" $max_depth = get_option('thread_comments_depth'); //add max_depth to the array and give it the value from above and set the depth to 1 $default = array( 'add_below' =&gt; 'comment', 'respond_id' =&gt; 'respond', 'reply_text' =&gt; __('Reply'), 'login_text' =&gt; __('Log in to Reply'), 'depth' =&gt; 1, 'before' =&gt; '', 'after' =&gt; '', 'max_depth' =&gt; $max_depth ); comment_reply_link($default,$comment_id,$post_id); </code></pre> <p>Then the link will show up. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload