From 4b95944d2702cd88627b19aefe67b4e80ca34e74 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 30 Sep 2025 21:01:32 +0100 Subject: [PATCH] Only load comments if we have a post id (#553) --- js/load-comments.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/load-comments.js b/js/load-comments.js index b4b321e..db70272 100644 --- a/js/load-comments.js +++ b/js/load-comments.js @@ -9,9 +9,13 @@ $( document ).ready( function() { var commentsURL = wpdc.commentsURL, - $commentArea = $( '#wpdc-comments' ), + $commentArea = $( '#wpdc-comments' ), postId = $commentArea.data( 'post-id' ); + if (!postId) { + return; + } + $.ajax( { url: commentsURL + '?post_id=' + postId,