Custom Taxonomies Flashcards
Q: What is a taxonomy in WordPress?
A: A way to group posts or custom post types together based on shared characteristics.
Q: What are the two default taxonomies in WordPress?
A: Categories and tags.
Q: What is a custom taxonomy?
A: A user-defined taxonomy for grouping custom post types or posts.
Q: What function is used to register a custom taxonomy?
A: register_taxonomy().
Q: What is the required parameter for register_taxonomy()?
A: The $taxonomy name (e.g., genre).
Q: What does the labels argument define in register_taxonomy()?
A: Text labels for the taxonomy in the WordPress admin interface.
Q: What does the hierarchical argument control?
A: Whether the taxonomy behaves like categories (true) or tags (false).
Q: What is the public argument used for in register_taxonomy()?
A: To determine if the taxonomy is accessible on the front end and admin.
Q: What does the show_ui argument do?
A: Determines whether the taxonomy appears in the WordPress admin UI.
Q: What is the rewrite argument used for?
A: To customise the URL structure for the taxonomy terms.
Q: How do you set the singular label for a custom taxonomy?
A: Use the singular_name key in the $labels array.
Q: How do you set the plural label for a custom taxonomy?
A: Use the name key in the $labels array.
Q: What label is used for the “Add New Term” button?
A: add_new_item.
Q: What label is used for editing a term?
A: edit_item.
Q: How do you set the label for the taxonomy admin menu?
A: Use the menu_name key in the $labels array.
Q: How do you associate a custom taxonomy with a custom post type?
A: Use the $object_type parameter in register_taxonomy().