So I came across this article today on the AdvancedWP Facebook group. I think I’ve seen wp_kses before, although I can’t quite place when, where, or why I may have seen it. Apparently, it is used when a post is saved to clean out any unwanted (or possibly malicious) tags.

Zack Tollman has a great write-up on what wp_kses is, what it does, and how fast it does it.

WordPress wp_kses function performance against long content
WordPress wp_kses function performance against long content. via

It’s not surprising that a function to sanitize content takes a while. Normally most people would use this on save (which happens once) and use something else on page view (which happens often). What I did find surprising was that the process took longer on each newer version of PHP which is the opposite of what I’d expect, although Zack does point out this was developed against PHP4.3 (yikes!). What is even MORE surprising is how fast HHVM performed it. Yowza!

Get the full details, and more tables and charts from Zack’s site: