Technical Mid Level

When would you create a custom post type versus using a custom taxonomy? Walk me through registering both and how you decide which fits a given requirement.

Quick Tip

Frame the decision clearly: "If it is a distinct thing with its own fields and templates, it is a post type. If it is a way to group existing things, it is a taxonomy. A recipe is a post type; cuisine is a taxonomy."

What good answers include

Custom post types represent distinct content types (e.g., events, products, portfolios). Taxonomies classify and group content (e.g., event categories, product tags). Register post types with register_post_type() and taxonomies with register_taxonomy(), both hooked to init. Key decisions: rewrite slugs for SEO-friendly URLs, capability_type for custom permissions, show_in_rest for block editor and REST API support, has_archive for listing pages. Strong candidates discuss: when to use existing post types with custom taxonomies versus creating new post types, and the importance of setting show_in_rest to true for Gutenberg compatibility.

What interviewers are looking for

Tests content modelling ability. Candidates who create custom post types for everything when a taxonomy would suffice are over-engineering. Those who shoehorn everything into posts and categories lack architectural thinking.

← All WordPress questions