in WordPress

Enable Threaded Comments in WordPress

Threaded comments is a nice feature to highlight to your visitors the admin comments or reply comments this enables better readability of the comments section of your blog posts. There are plugins which allow you to enable threaded comments but this can easily be done by using a wordpress hook. Just add the below snippet into your functions.php.


// enable threaded comments
function enable_threaded_comments(){
if (!is_admin()) {
     if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
          wp_enqueue_script('comment-reply');
     }
}

add_action('get_header', 'enable_threaded_comments');

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To The Weekly Newsletter

Get weekly updates to your email