What is `wp_kses()` in WordPress and when should it be used?

WordPress Fundamental Medium

WordPress Fundamental — Medium

What is `wp_kses()` in WordPress and when should it be used?

Key points

  • `wp_kses()` filters HTML through a whitelist
  • It strips unauthorized HTML but preserves allowed markup
  • Important for security when handling user input
  • Prevents cross-site scripting attacks

Ready to go further?

Related questions