Complete the code to safely display a variable in WordPress output.
echo [1]($user_input);sanitize_text_field() for output instead of input sanitization.var_dump() or print_r() for output.Use esc_html() to safely escape output for HTML context in WordPress.
Complete the code to escape a URL before outputting it in WordPress.
echo '<a href="' . [1]($url) . '">Link</a>';
esc_html() which is for HTML content, not URLs.sanitize_text_field() which is for input sanitization.Use esc_url() to safely escape URLs in WordPress output.
Fix the error in escaping an attribute value in WordPress output.
echo '<input type="text" value="' . [1]($value) . '">';
esc_html() which is for HTML content, not attributes.esc_url() which is for URLs only.Use esc_attr() to escape values inside HTML attributes safely.
Fill both blanks to escape a textarea content and its label in WordPress output.
<label for="comment">[1]( 'Your Comment' )</label> <textarea id="comment">[2]($comment_text)</textarea>
esc_attr() for textarea content which is incorrect.Use esc_html_e() to escape and echo translated text for labels, and esc_textarea() to escape textarea content safely.
Fill all three blanks to safely output a link with title and URL in WordPress.
<a href="[1]" title="[2]">[3]</a>
sanitize_text_field() for output escaping instead of input sanitization.Escape the URL with esc_url(), the title attribute with esc_attr(), and the link text with esc_html() for safe output.