Where is $comments array created? What file, what function?
-
I’m in my comments.php and I see that $comments is a global array that WP creates. Even if your theme uses cool new functions to get comments, $comments is still there whether you like it or not.
I want to know where it is created so I can take a look at the code. What is the problem? Well, $comments is a HUGE array, it loads all of your comments, even if you’re doing pagination or whatever. So if you have 1,000 comments on a post, it doesn’t make sense to have an array that big in memory.
I can fix the MySQL, that’s not my problem. I just can’t figure out where $comments is created. Various searches not helping me, $comments appears around 900 times in WP’s code and Google isn’t helping me either. All I need is a hint. Thanks.
- The topic ‘Where is $comments array created? What file, what function?’ is closed to new replies.