Anybody know anything about what the comments page in the WordPress administrative interface might be doing to call into themes?

I’ve been trolling through the codex for a while, but hey surprise wordpress is a big project and this is a lot of code to troll. But basically, the comments page in the administrative interface takes a very long time to load (>20s) if my current desktop theme is in use.

If I switch to twentysixteen (the current standard included theme), it takes very little time – basically, an immediate load. That’s changing nothing else, and it is 100% reproducible.

My suspicion is that it’s running some sort of check against the comments contents and/or metadata. I suspect specifically something to do with the avatars, but that’s very much a guess.

This is 100% unrelated to my digital audio workstation woes – completely different machines – and is something that has been bugging me for a while. It started all at once, after we rebuilt the server following the hax0r last year.

Anybody out there with knowledge? Do I get lucky?

eta: I was chatting with mpol on the wordpress IRC channel, who found something in the theme’s functions.php that I’d looked at askance before, and it’s this filter call:

add_filter('get_comments_number', 'comment_count', 0);

And if I comment that out, suddenly we behave a lot better and I don’t see a functionality loss. Anybody know what this might even be doing? It’s line 364 here.

eta2: I know what that filter was doing now. I think without that filter their custom comments counter (which added behaviour I didn’t actually like and had worked around elsewhere) becomes redundant and I’ve commented it out entirely with no bad beahviour so far. Anyone see anything weird with comment counts?

eta3: So far this is working much better! But possibly related, and possibly not, I am still getting admin-panel connection resets at random. Reloads always work, and of course, Query Monitor is not helpful here because the reload works fine without issues or errors. All of Firefox’s explanations are wrong, and this happens under Safari too.

The connection was reset

The connection to the server was reset while the page was loading.

The site could be temporarily unavailable or too busy. Try again in a few moments.

eta4: Many super-thanks to Kirrus on Twitter who has been majorly helpful on this. I’m still seeing the connection reset, but the comment issue is cleared out and along the way, using tools he and mpol recommended, I found an assortment of bugs affecting performance in the two abandonware plugins I still run and more or less privately maintain. Also, one in my now-custom once-piano-black theme which would’ve meant White Screen of Death under PHP7. I’LL NEVER CHANGE THEMES NOW XD

eta5: For even more confusing information on the remaining problem, see this entry on Dreamwidth. Honestly, what the hell?