Enable Threaded Comments in WordPress

WordPress has threaded comments so if you need to enable it from WordPress in just one minute using this code snippet where let you enable it by WordPress built-in script.

Steps to enable threaded comments:

  1. Open WordPress admin panel then go to Appearance > Theme Editor
  2. Open theme functions.php file, if you work localhost open the same file using any code editor IDE
  3. Add the following code at the bottom of the file.
  4. Save the changes.
function zytheme_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', 'zytheme_enable_threaded_comments');

Did you find the WordPress snippets in this article helpful? Share it with your friends and if you have any questions and want to ask us about it, please don’t hesitate to add comments.

Newsletter Updates

Enter your email address below to subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *