wpsmith / genesis-sandbox-featured-content-widget

Genesis Sandbox Featured Content Widget. Based on Nick Croft's Genesis Featured Widget Amplified for additional functionality which allows support for custom post types, taxonomies, and extends the flexibility of the widget via action hooks to allow the elements to be re-positioned or other elements to be added.
39 stars 21 forks source link

Large number of tags/terms results in widget admin failure #7

Open jb510 opened 10 years ago

jb510 commented 10 years ago

I have a site with 60,000 post_tags. The widget admin page just dies on the sandbox widget (left side, not in a widget area yet).

I initially commented out the widget.php:1574-1609 to get around it. At which point the widget admin page loaded fine.

I then removed 40,000 of our tags (0 & 1 post count), so now "only" 20,000 tags. Still pretty ridiculous, but the widget admin will load without commenting out that section of widget.php. It takes 75s & 180MB (Query Monitor plugin) to load on my local install however.

With that I added the widget to a sidebar and ended up with a select box in the widget with 20,300 items :(

I didn't write a patch because I'm not sure what the answer here is. I think I'd first split categories from tags on posts. Second, I don't think I'd load tags until a check box is selected in the widget.

For now I've changed widget.php:1583 to

$taxonomies = get_taxonomies( array( 'public' => true, 'name' =>'category' ), 'objects' );

With just the 300 categories the widget admin page is loading in about 25s & 64MB which is tolerable and I can check out the transient caching which is what I am really ultimately after here (This site uses a couple dozen Genesis Featured posts widgets in several different widget areas and the all queries are murder... home page is current over 500 queries, ouch!).

For now I'm just testing with my slightly modified version, but long term, something probably needs to happen to deal with this use case since it effectively breaks that widget admin.

wpsmith commented 10 years ago

@jb510 Mind giving this a shot?

wpsmith commented 10 years ago

jb510 would you mind testing?

jb510 commented 10 years ago

Yes, I'll test on that big DB

jb510 commented 10 years ago

@wpsmith Finally got this tested. Sorry it took so long. The widget page still fails to load, unless, I have the filter set to restrict the query to categories: function jb_gsfc_get_taxonomies_args() { $args = array( 'public' => true, 'name' =>'category' ); return $args; } add_filter('gsfc_get_taxonomies_args','jb_gsfc_get_taxonomies_args');

I wasn't clear if the goal was to fix things even when still querying tags?

With the filter, things work fine.

graphicdesignbyemily commented 10 years ago

Having a similar issue - was using 8 widget instances targeting all different categories and it crippled my plugin.php - had to remove the plugin and went to genesis default and now no problems loading widgets :(