X

Enable threaded comments

WordPress has support for threaded comments, but you have to enable it yourself, by adding a script to your head. You can use WordPress built in function wp_enqueue_script() to load the script, by adding this snippet to your functions.php.

When the script is loaded, you have to activate the threaded comments in the settings tab in WordPress admin, under Settings > Discussion. Click Enable threaded (nested) comments and choose the level of nested comments you want.

Code Snippet:

<?php
function enable_threaded_comments(){
    if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
       wp_enqueue_script('comment-reply');
    }
}
add_action('get_header', 'enable_threaded_comments');
?>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!