Complete the code to sanitize a text field input in WordPress.
$safe_text = [1]($_POST['user_input']);
The sanitize_text_field function cleans text input by stripping tags and removing invalid characters, making it safe for storage.
Complete the code to allow safe HTML tags in user input using WordPress functions.
$allowed_html = array('a' => array('href' => array())); $safe_html = [1]($_POST['content'], $allowed_html);
The wp_kses function filters content to allow only specified HTML tags and attributes, preventing harmful code.
Fix the error in sanitizing an email input in WordPress.
$email = [1]($_POST['email']);
The sanitize_email function properly cleans email addresses by removing invalid characters.
Fill both blanks to sanitize and then escape a URL input safely.
$url = [1]($_POST['website']); $escaped_url = [2]($url);
First, esc_url_raw sanitizes the URL for storage, then esc_url escapes it for safe output in HTML.
Fill all three blanks to sanitize a checkbox input and safely use it in HTML.
$checked = isset($_POST['agree']) ? [1]($_POST['agree']) : 0; $checked = $checked ? 1 : 0; echo '<input type="checkbox"' . ($checked ? ' ' . [2]("checked") : '') . ' />'; $label = '[3]';
Use absint to convert checkbox input to integer 0 or 1, esc_attr to escape the 'checked' attribute value, and a safe label string.