0
0
Wordpressframework~10 mins

Options API for site-wide settings in Wordpress - Interactive Code Practice

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

Complete the code to save a site-wide option named 'site_color' with the value 'blue'.

Wordpress
update_option('site_color', [1]);
Drag options to blanks, or click blank then click option'
A'blue'
Bblue
C"site_color"
Dget_option('site_color')
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the string value.
Using the option name as the value.
2fill in blank
medium

Complete the code to retrieve the value of the site-wide option 'site_color'.

Wordpress
$color = [1]('site_color');
Drag options to blanks, or click blank then click option'
Aset_option
Bdelete_option
Cupdate_option
Dget_option
Attempts:
3 left
💡 Hint
Common Mistakes
Using update_option instead of get_option.
Using set_option which does not exist.
3fill in blank
hard

Fix the error in the code to delete the site-wide option 'site_color'.

Wordpress
[1]('site_color');
Drag options to blanks, or click blank then click option'
Aunset_option
Bdelete_option
Cremove_option
Dclear_option
Attempts:
3 left
💡 Hint
Common Mistakes
Using remove_option which does not exist.
Using unset_option which is not a WordPress function.
4fill in blank
hard

Fill both blanks to register a new option group and add a setting field for 'site_color'.

Wordpress
register_setting('[1]', '[2]');
Drag options to blanks, or click blank then click option'
Ageneral
Bsite_color
Cadmin
Dcolor_option
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the group and option names.
Using incorrect group names like 'admin'.
5fill in blank
hard

Fill all three blanks to create a settings field for 'site_color' with label 'Site Color' in the 'general' page.

Wordpress
add_settings_field('[1]', '[2]', '[3]', 'general', 'default');
Drag options to blanks, or click blank then click option'
Asite_color
BSite Color
Cdisplay_site_color_field
Dsite_color_field
Attempts:
3 left
💡 Hint
Common Mistakes
Using the label as the first blank.
Using a wrong callback function name.