Adding widgets with Featured Image via the Customizer runs hundreds of queries


(Vasili) #1

I add a widget via the Customizer. It’s a simple widget, with basic loop, which displays 10 latest posts where each post have Featured Image. Because of the Featured Image, this widget run hundreds of queries, without Featured Image the number of queries returns back to normal.

It happens only when adding widgets and viewing the site via the Customizer, there is no such issue on the front end.

Also tested with the default WP Recent Posts widget, the result was the same.

Have anyone experienced something similar?


(Leland Fiegel) #2

Haven’t noticed this before, but thought it was worth noting that the default Recent Posts widget does not contain a featured image option.

Are you using a separate plugin that alters the Recent Posts widget, by any chance? Is the “simple widget” you’re referring to a custom one? Could you share the code for that? A link to a GitHub gist would be fine.


(Vasili) #3

Hi leland,

For testing i’ve made a copy of this widget and placed it inside the theme, changed it’s class name.

Basically this issue is a common issue for all widgets which have the Featured Image function. I got help from Weston Ruter, the Customizer creator and core committer on Stack Exchange. Here it is if anyone wants to know the reason and the solution:


(Leland Fiegel) #4

Interesting! Good to know.