Opened 14 years ago
Closed 13 years ago
#16799 closed enhancement (fixed)
Bloated Custom Menus
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.3 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Menus | Keywords: | has-patch |
Focuses: | Cc: |
Description
tl;dr = WordPress should limit the size of auto generated descriptions for menus. Ideally there should be no menu item descriptions.
I'm working on a project that uses a lot of custom menus. So many custom menus in fact that editing them nearly brings my server to it's knees. (10 menus x 70 items each maximum 2 levels deep)
The biggest problem I found is WordPress loads a description with each menu item. I had to turn off JavaScript to even see this field and that's when I saw large blobs of content are being loaded with each and every menu items.
When loading one menu Firebug clocked the HTML page weighing in at 2.3MB. I went to my database and ran the following SQL to remove the offending blurbs of bloated text...
UPDATE posts
SET post_content
= WHERE post_type
LIKE 'nav_menu_item';
This reduced the page weight by half to 1.1MB. The menu still took a bit to load but now I could save it back to the database successfully.
Other work arounds to make custom menus usable included raising the max execution time for PHP on my server and increasing the $_POST and $_GET size limit.
Custom menus need to go on diet.
Attachments (5)
Change History (17)
#2
@
14 years ago
- Component changed from General to Menus
- Type changed from defect (bug) to enhancement
- Version set to 3.1
I tend to agree, as far as pages go. I just made a custom menu, and it put the entire page content into the description field, which is insane. I can see auto-populating a description for things that have a Description field already (like Categories), but putting the full page into description is overkill.
#3
@
14 years ago
We should shift it to excerpts, if not just blank. I figured that's what it already was.
#4
@
14 years ago
- Keywords has-patch added
Patch assumes #16372 committed, as we need that to generate the excerpt.
#8
in reply to:
↑ 7
@
13 years ago
Replying to duck_:
In [18733]:
Setting description and attr_title to blank for all new nav menu items per IRC discussion with rboren.
Further work:
- Dropping more inputs from Walker_Nav_Menu_Checklist, e.g. attr_title (this has a typo in the name attribute anyway), xfn, target
- Trimming the description (and title's) of old nav menu items. See filosofo's patch.
#11
@
13 years ago
16799.remove-inputs.diff pulls out some more hidden inputs from WP_Nav_Menu_Checklist. menu-item-object and menu-item-type are required for the code in admin-ajax.php to retrieve the objects to convert to menu items. menu-item-url is necessary for no-JS as it's used in wp_save_nav_menu_items().
Savings on a site with 200 posts, 51 pages, 20 cats and tags. nav-menus.php with no menus drops from 259KB to 144KB.
See #14415 ("but there's [no] reason we couldn't omit a couple of others"), [16096]
#12
@
13 years ago
- Resolution set to fixed
- Status changed from new to closed
Main thrust of this ticket was removing descriptions, which is done, so am closing ticket as fixed. To propose/submit additional menu enhancements, please open new. specific tickets, one idea per ticket so that they can be tracked more easily.
Related: #14134