Help about Escaping

Here’s just a few examples of what escaping looks like:

Escaping URLS:

<?php echo esc_url( home_url() ); ?>

Escaping Content

<?php echo esc_html( get_the_title() ); ?>

Escaping Attributes

<?php echo esc_attr( $my_class ); ?>

Escaping Content but keep HTML

<?php echo wp_kses_post( get_the_content() ); ?>

Escaping Emails

<?php echo sanitize_email( $email_address ) ); ?>

For more information about escaping, here’s a good resource on data sanitization.