Bird
0
0

Identify the error in this plugin code snippet:

medium📝 Debug Q6 of 15
Wordpress - Plugins and Extensibility
Identify the error in this plugin code snippet:
add_action('wp_footer', 'my_footer_function');\nfunction my_footer_function { echo 'Footer text'; }
AMissing parentheses in function declaration
BWrong hook name 'wp_footer'
CEcho cannot be used in plugins
DFunction name must start with underscore
Step-by-Step Solution
Solution:
  1. Step 1: Check function syntax

    The function declaration lacks parentheses after the name, which is a syntax error.
  2. Step 2: Verify hook and echo usage

    'wp_footer' is a valid hook and echo is allowed in plugin functions.
  3. Final Answer:

    Missing parentheses in function declaration -> Option A
  4. Quick Check:

    Function syntax requires parentheses [OK]
Quick Trick: Functions always need parentheses () [OK]
Common Mistakes:
MISTAKES
  • Ignoring missing parentheses
  • Thinking hook name is wrong
  • Believing echo is disallowed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes