Ticket #5326 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Don't use sanitize_title in widgets API

Reported by: ryan Assigned to: anonymous
Priority: normal Milestone: 2.5
Component: General Version: 2.5
Severity: normal Keywords: performance
Cc:

Description

widgets.php calls sanitize_title() on widget IDs. For the new API (functions starting with wp_), this isn't necessary. sanitize_title() is a slow function that does lots of stuff we don't need to do when sanitizing an ID. Let's just drop the sanitization and take the ID as is. For the old widgets API (functions without wp_), the sanitization can stay for maximum back-compat.

Attachments

sanitize_widgets.diff (0.7 kB) - added by ryan on 11/07/07 17:03:14.

Change History

11/07/07 17:03:14 changed by ryan

  • attachment sanitize_widgets.diff added.

11/07/07 17:06:57 changed by ryan

This patch reduced the number of calls to sanitize_title() from 103 to 2 on my testbed. The amount of time spent in sanitize_title() dropped from almost 10% to a fraction of a percent.

11/08/07 00:56:54 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [6323]) Don't run sanitize_title on IDs in new widgets API to avoid performance overhead. fixes #5326