Bird
0
0

Which of the following is the correct way to register a shortcode named hello in WordPress?

easy📝 Syntax Q12 of 15
Wordpress - Shortcodes and Blocks
Which of the following is the correct way to register a shortcode named hello in WordPress?
Aregister_shortcode('hello', 'hello_function');
Badd_shortcode('hello_function', 'hello');
Cadd_shortcode('hello', 'hello_function');
Dregister_shortcode('hello_function', 'hello');
Step-by-Step Solution
Solution:
  1. Step 1: Recall shortcode registration syntax

    The correct function is add_shortcode with first argument as shortcode tag, second as callback function.
  2. Step 2: Match correct argument order

    add_shortcode('hello', 'hello_function'); uses add_shortcode('hello', 'hello_function'), which is correct syntax.
  3. Final Answer:

    add_shortcode('hello', 'hello_function'); -> Option C
  4. Quick Check:

    add_shortcode(tag, callback) = correct [OK]
Quick Trick: Use add_shortcode('tag', 'function') to register [OK]
Common Mistakes:
  • Using register_shortcode instead of add_shortcode
  • Swapping the order of arguments
  • Passing function name as first argument

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes