Bird
0
0

Which of the following is the correct way to register a custom taxonomy called genre for posts in WordPress?

easy📝 Syntax Q12 of 15
Wordpress - Custom Post Types and Taxonomies
Which of the following is the correct way to register a custom taxonomy called genre for posts in WordPress?
Aregister_taxonomy('genre', 'post', array('hierarchical' => true));
Bregister_taxonomy('genre', 'posts', array('hierarchical' => true));
Cregister_taxonomy('genre', array('post'), 'hierarchical' => true);
Dregister_taxonomy('genre', 'post', 'hierarchical' => true);
Step-by-Step Solution
Solution:
  1. Step 1: Check the function signature of register_taxonomy()

    The function requires taxonomy name, object type(s) as string or array, and an array of arguments.
  2. Step 2: Verify correct parameter types and syntax

    register_taxonomy('genre', 'post', array('hierarchical' => true)); uses 'post' as string and an array for arguments correctly.
  3. Final Answer:

    register_taxonomy('genre', 'post', array('hierarchical' => true)); -> Option A
  4. Quick Check:

    Correct syntax uses array for args and string for post type [OK]
Quick Trick: Use array() for args and string or array for post types [OK]
Common Mistakes:
  • Using plural 'posts' instead of 'post'
  • Passing arguments outside an array
  • Wrong parameter order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes