Skip to content

Commit 221d3f4

Browse files
committed
All: Limit 'comment-reply' script to posts with comments open
WordPress default themes do this since at least twentynineteenn (2019) since it doesn't have a purpose on posts even if they had old comments that use threads since the script is to help author new comments. Also turn it off globally by default to reflect current reality since not even the blog had this feature enabled during the time where comments were used.
1 parent 08f27c1 commit 221d3f4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sites.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,13 @@ function jquery_default_site_options() {
369369
'blogdescription' => '',
370370
'permalink_structure' => '/%postname%/',
371371
'use_smilies' => 0,
372+
// The one site where comments are sometimes enabled (blog.jquery.com)
373+
// has always had thread_comments turned off.
374+
//
375+
// Oher sites like api.jquery.com implement their pages as posts,
376+
// but naturally don't support comments at all. Turn this off to
377+
// remove the WordPress comment-reply script from pages by default.
378+
'thread_comments' => 0,
372379
);
373380

374381
}

themes/jquery/header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
3030
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/docsearch.css">
3131
<?php
32-
if ( is_singular() && get_option( 'thread_comments' ) ) {
32+
if ( get_option( 'thread_comments' ) && comments_open() ) {
3333
wp_enqueue_script( 'comment-reply' );
3434
}
3535

0 commit comments

Comments
 (0)