Make WordPress Core

Opened 8 years ago

Closed 11 months ago

#36745 closed enhancement (invalid)

_wp_menu_item_classes_by_context

Reported by: spacedmonkey's profile spacedmonkey Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: has-patch dev-feedback has-unit-tests
Focuses: performance Cc:

Description

_wp_menu_item_classes_by_context currently uses wp_get_object_terms. wp_get_object_terms has no caching in the function. get_the_terms function does have caching and should be used in this context.

Attachments (3)

test.patch (913 bytes) - added by spacedmonkey 8 years ago.
36745.patch (3.2 KB) - added by spacedmonkey 8 years ago.
36745.1.patch (3.6 KB) - added by spacedmonkey 8 years ago.

Download all attachments as: .zip

Change History (11)

@spacedmonkey
8 years ago

#1 @spacedmonkey
8 years ago

  • Keywords has-patch added

#2 @spacedmonkey
8 years ago

  • Type changed from enhancement to defect (bug)

I have changed this from enhancement to a bug. The fact that it doesn't use the caching function can be a massive performance issue, if there are lots of taxonomies and menu items. I believe this fix should go in the 4.5.2 release.

This ticket was mentioned in Slack in #core by spacedmonkey. View the logs.


8 years ago

@spacedmonkey
8 years ago

#4 @spacedmonkey
8 years ago

  • Keywords dev-feedback has-unit-tests added
  • Type changed from defect (bug) to enhancement

Unit tests added. The unit tests should prove that the caching is working on single post pages.

#5 @spacedmonkey
8 years ago

Looking at this patch, a couple of line above it, it checks it is_taxonomy_hierarchical. It should really also check to see if the taxonomy is public. I can't think of a example where an underline would be needed for a non public taxonomy.

#6 @spacedmonkey
8 years ago

Added a new patch. This one adds a check to see that the taxonomy is public. This will decrease the number of calls to cache / db for none public taxonomies.

This ticket was mentioned in Slack in #core by spacedmonkey. View the logs.


8 years ago

#8 @spacedmonkey
11 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Closing as invalid.

Note: See TracTickets for help on using tickets.