0
0
Wordpressframework~10 mins

Why WordPress security is critical - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if a user is logged in WordPress.

Wordpress
<?php if ([1]()) { echo 'User is logged in'; } ?>
Drag options to blanks, or click blank then click option'
Alogged_in_check
Bcheck_user
Cuser_logged
Dis_user_logged_in
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent function like check_user.
Confusing function names.
2fill in blank
medium

Complete the code to sanitize user input in WordPress.

Wordpress
<?php $safe_input = [1]($_POST['user_input']); ?>
Drag options to blanks, or click blank then click option'
Asanitize_text_field
Bclean_input
Csanitize_user_input
Dsecure_input
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent functions like clean_input.
Not sanitizing input at all.
3fill in blank
hard

Fix the error in the code to properly enqueue a secure script in WordPress.

Wordpress
<?php wp_enqueue_script('my-script', get_template_directory_uri() . '/js/script.js', array(), [1], true); ?>
Drag options to blanks, or click blank then click option'
A'1.0.0'
Bfalse
Cnull
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using boolean true or false instead of a version string.
Passing null which disables versioning.
4fill in blank
hard

Fill both blanks to create a nonce field for security in a WordPress form.

Wordpress
<?php wp_nonce_field([1], [2]); ?>
Drag options to blanks, or click blank then click option'
A'my_action'
B'my_nonce_field'
C'nonce_action'
D'nonce_field'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the parameters.
Using invalid strings or variables.
5fill in blank
hard

Fill all three blanks to verify a nonce in WordPress before processing form data.

Wordpress
<?php if (isset($_POST[[1]]) && wp_verify_nonce($_POST[[2]], [3])) { /* process form */ } ?>
Drag options to blanks, or click blank then click option'
A'my_nonce_field'
C'my_action'
D'nonce_check'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for nonce field in isset and verify.
Incorrect action name.