• I am currently overhauling my website and am migrating posts and comments. I noticed when I ran speed tests on a post with 235 comments that I got dinged for an excessive number of DOM elements (as per GT Metrix and Google Page Speed Insights). See screenshot below:

    https://imgur.com/2iWaXLP

    At first I couldn’t figure it out. I deactivated all plugins and still had the issue.

    When I created a duplicate post of the one above but WITHOUT the 235 comments, I ran the exact same scan and noticed that the problem went away. See follow up screenshot:

    https://imgur.com/7qGzPzL

    I’ve searched online and was unable to find anything on why WordPress comments would lead to excessive DOM elements on the page.

    Thanks in advance for any pearls of wisdom.

    Kind regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Well, because 235 comments! Each requires a goodly chunk of structure to allow you to display them properly. I think you’re misunderstanding what GTMETRIX is telling you. There is no problem here.

    Thread Starter mesotu

    (@mesotu)

    Thanks for your reply @sterndata Yep, always learning. I figured it was due to the nested comments maybe (?). A friend of mine has an article with 1400 comments on it but has 1756 DOM elements on the page compared to my 3800 DOM elements for 235 comments.

    Then as I thought about it, what if I changed the number of comments that appear on a page in the Discussion Settings. I did that and voila, problem solved. If people want to read the comments, then they just need to click on “older” and “newer” comments in the navigation.

    Screenshot here:
    https://imgur.com/XgqNgxR

    For anyone getting dinged for excessive DOM elements on Google Page Speed Insights or GT Metrix, this will probably help you.

    Thanks @sterndata

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excessive DOM Elements Due to WordPress Comments’ is closed to new replies.