0
0
Wordpressframework~10 mins

Why hooks enable extensibility in Wordpress - Test Your Understanding

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

Complete the code to add a function to a WordPress action hook.

Wordpress
add_action('init', [1]);
Drag options to blanks, or click blank then click option'
A'init_function'
B'my_custom_function'
C'hook_function'
D'start_function'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to put the function name in quotes.
Using a function name that does not exist.
2fill in blank
medium

Complete the code to apply a filter to modify content in WordPress.

Wordpress
add_filter('the_content', [1]);
Drag options to blanks, or click blank then click option'
A'modify_content'
B'change_text'
C'content_filter'
D'filter_content'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name that does not exist.
Not using quotes around the function name.
3fill in blank
hard

Fix the error in the code to correctly remove a filter in WordPress.

Wordpress
remove_filter('the_title', [1]);
Drag options to blanks, or click blank then click option'
A'modify_title'
BmodifyTitle
C'modifyTitle'
Dmodify_title
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the function name without quotes.
Using a different function name than was added.
4fill in blank
hard

Fill both blanks to add a filter with priority and accepted arguments.

Wordpress
add_filter('the_excerpt', [1], [2]);
Drag options to blanks, or click blank then click option'
A'custom_excerpt'
B10
C2
D'excerpt_filter'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of priority and function name.
Not using quotes for the function name.
5fill in blank
hard

Fill all three blanks to add an action hook with function, priority, and accepted arguments.

Wordpress
add_action('wp_footer', [1], [2], [3]);
Drag options to blanks, or click blank then click option'
A'footer_message'
B1
C0
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong priority number.
Not quoting the function name.
Setting accepted arguments incorrectly.