Prevent WordPress from loading comments

You can’t prevent comments_template() from making an SQL query. Well, you could maybe hook into the DB layer to prevent just that specific query, but that would be very cumbersome to do. If this is for a theme, you could just remove the call to comments_template() and replace it with your own function. comments_template() doesn’t do that much: just load all the comments, maybe also the just-submitted comment if it isn’t approved yet, separate them into pings, trackbacks and regular comments if needed, and load the comments template file. Comments paging is relatively young in WordPress, so it’s probably not as efficient as it could be yet.

Leave a Comment