• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Alex Mustin
  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me
Alex Mustin
  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me
Alex Mustin

Alex Mustin

  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me
  • About
  • Services
  • WordPress Tips
  • Websites
  • Plugins
  • Contact Me

Enable Threaded Comments in your WordPress Theme

April 3, 2015 in Code Snippets, Development

Threaded Comments are a great way to visually show direct replies to comments. When a person replies to a comment already on your site, the reply will display indented underneath the original comment. To enable Threaded Comments in your theme, simply add the following lines to your functions.php file:

add_action('get_header', 'enable_threaded_comments');
function enable_threaded_comments() {
    if (!is_admin()) {
        if (is_singular() && comments_open() && (get_option('thread_comments') == 1))
            wp_enqueue_script('comment-reply');
    }
}

Now you will be able to see Threaded Comments wherever comments are shown on your theme.

Filed Under: Code Snippets, Development

Reader Interactions

Comments

  1. Muskie says

    January 8, 2019 at 2:27 am

    I added this to my functions.php as part of my upgrading my blog and theme to WordPress 5.0.2 and it doesn’t quite work. I can leave a comment and old comments can be threaded that were left while I was running DISQUS. I have to remove DISQUS for speed and because it is blocked in China so I’m trying to make native WordPress plugins work. What else could be causing this? I get this error in the console to:

    ReferenceError: Can’t find variable: addComment

    Reply

Leave a Reply Cancel reply

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

Footer

Developing creative WordPress websites and solutions for companies of all sizes since 2008.

SOLUTIONS

  • One-Page Website
  • Maintenance Service

RESOURCES

  • Client Login
  • WordPress Tips
  • Mastodon

© 2025 Alex Mustin