Complete the code to safely output a user input in WordPress.
<?php echo [1]($_GET['user_input']); ?>
Use esc_html to safely escape HTML characters and prevent XSS.
Complete the code to sanitize a text input before saving in WordPress.
$safe_text = [1]($_POST['comment']);
sanitize_text_field cleans text input by stripping tags and harmful content.
Fix the error in escaping a URL output in WordPress.
<a href="[1]($url)">Link</a>
esc_url properly escapes URLs for safe output in HTML attributes.
Fill both blanks to allow safe HTML tags in user input and output it.
<?php $allowed_tags = [1](); echo [2]($user_input, $allowed_tags); ?>
wp_kses_allowed_html returns allowed HTML tags, and wp_kses filters input to allow only those tags.
Fill all three blanks to create a safe attribute output with a default fallback.
<?php $title = isset($data['title']) ? [1]($data['title']) : [2]; echo '<h1 title="' . [3]($title) . '">' . $title . '</h1>'; ?>
sanitize_text_field cleans the input, "Default Title" is fallback text, and esc_attr safely escapes the attribute.
