Data Sanitization and Escaping in Themes — a practical guide to WordPress sanitize escape theme with clear examples you can reuse in real projects.
WordPress Theme Development Series (71/96). Prefer one article? Read the complete WordPress theme development tutorial.
Short description
Use `esc_html`, `esc_attr`, `esc_url`, and `wp_kses_post` according to context.
Escape in templates
<h1><?php echo esc_html(get_the_title()); ?></h1>
<a href="<?php echo esc_url(get_permalink()); ?>">Read</a>