Recall & Review
beginner
What does XSS stand for and why is it dangerous in WordPress?
XSS stands for Cross-Site Scripting. It is dangerous because attackers can inject harmful scripts into web pages viewed by other users, stealing data or hijacking sessions.
Click to reveal answer
beginner
Which WordPress function should you use to safely output data in HTML to prevent XSS?
Use
esc_html() to safely output data inside HTML content, escaping harmful characters to prevent XSS.Click to reveal answer
intermediate
How does
esc_attr() help in XSS prevention?esc_attr() escapes data before placing it inside HTML attributes, stopping attackers from injecting scripts via attributes.Click to reveal answer
beginner
Why should you never trust user input directly in WordPress?
User input can contain malicious code. Always sanitize and escape it before use to prevent XSS and other attacks.
Click to reveal answer
intermediate
What is the difference between sanitizing and escaping in WordPress XSS prevention?
Sanitizing cleans input data before saving it. Escaping cleans data before outputting it. Both protect against XSS but at different stages.
Click to reveal answer
Which WordPress function escapes data for safe use inside HTML attributes?
✗ Incorrect
esc_attr() is used to escape data inside HTML attributes to prevent XSS.What is the main purpose of
wp_kses() in WordPress?✗ Incorrect
wp_kses() filters input to allow only safe HTML tags, helping prevent XSS.When should you escape data in WordPress to prevent XSS?
✗ Incorrect
Escaping should happen right before output to ensure data is safe for that context.
Which function is best to sanitize a plain text input before saving it?
✗ Incorrect
sanitize_text_field() cleans plain text input before saving to prevent harmful data.What is a common sign of an XSS vulnerability in WordPress?
✗ Incorrect
Showing user input without escaping can allow attackers to inject scripts, causing XSS.
Explain how you would prevent XSS attacks when displaying user comments in WordPress.
Think about both input cleaning and output escaping.
You got /4 concepts.
Describe the difference between sanitizing and escaping in WordPress and when to use each.
Consider the data flow from user input to display.
You got /4 concepts.