0
0
Wordpressframework~10 mins

Common filter hooks 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 add a filter that modifies the content.

Wordpress
add_filter('the_content', '[1]');
Drag options to blanks, or click blank then click option'
Athe_title
Bwp_footer
Cinit
Dmodify_content
Attempts:
3 left
💡 Hint
Common Mistakes
Using an action hook name instead of a filter hook name.
Passing a hook name instead of a function name.
2fill in blank
medium

Complete the code to apply a filter to the post title.

Wordpress
add_filter('[1]', 'custom_title_filter');
Drag options to blanks, or click blank then click option'
Athe_content
Bthe_title
Cwp_head
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'the_content' instead of 'the_title'.
Using an action hook like 'init' instead of a filter hook.
3fill in blank
hard

Fix the error in the filter hook to modify the excerpt.

Wordpress
add_filter('the_excerpt', [1]);
Drag options to blanks, or click blank then click option'
A'modify_excerpt'
Bmodify_excerpt
C'the_excerpt'
Dthe_excerpt
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the function name without quotes.
Passing the hook name instead of the function name.
4fill in blank
hard

Fill both blanks to create a filter that changes the widget title with priority 15.

Wordpress
add_filter('[1]', '[2]', 15);
Drag options to blanks, or click blank then click option'
Awidget_title
Bchange_widget_title
Cthe_content
Dmodify_content
Attempts:
3 left
💡 Hint
Common Mistakes
Using content-related hooks instead of widget title hooks.
Using function names that do not match the hook purpose.
5fill in blank
hard

Fill all three blanks to add a filter that modifies comment text with priority 20 and 2 accepted arguments.

Wordpress
add_filter('[1]', '[2]', 20, [3]);
Drag options to blanks, or click blank then click option'
Acomment_text
Bmodify_comment_text
C2
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong hook names like 'comment_post'.
Setting incorrect number of accepted arguments.