Auto-Enable Threaded/Nested Comments in WordPress

Threaded comments let people reply to each other

In theme or functionality plugin

You can auto-enable nested comments in your theme’s functions.php file or in your functionality plugin. Just use the code below.

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');

That’s all there is to it. Threaded/nested comments will automatically be enabled, so you won’t have to turn them on in the WordPress Dashboard like you normally would.

0

Well, now what?

Work with Me

I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!

Leave some Feedback

Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. 😀

Longren.io is proudly hosted by DigitalOcean

DigitalOcean

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.