Bird
0
0

Identify the error in the following code snippet:

medium📝 Debug Q6 of 15
Wordpress - WordPress Hooks System
Identify the error in the following code snippet:
function custom_filter($content) { return $content . ' Extra'; }
add_filter('the_content', 'custom_filter');
remove_filter('the_content', 'custom_filter', 20);
AFunction name is incorrect
BPriority mismatch causes remove_filter to fail
Cremove_filter should be remove_action
DMissing parentheses in function call
Step-by-Step Solution
Solution:
  1. Step 1: Check priority in add_filter and remove_filter

    add_filter uses default priority 10, remove_filter uses 20.
  2. Step 2: Understand effect of priority mismatch

    Removal fails because priorities differ.
  3. Final Answer:

    Priority mismatch causes remove_filter to fail -> Option B
  4. Quick Check:

    Priority must match to remove filters [OK]
Quick Trick: Always use same priority to remove filters [OK]
Common Mistakes:
  • Using remove_action instead of remove_filter
  • Assuming default priority if not specified
  • Ignoring priority in removal

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes