Key Takeaways
- Custom post types organize distinct content types beyond posts/pages
- Taxonomies classify and group content within post types
- Plan your content architecture before implementation
- Use plugins for simple cases, code for complex requirements
- Consider URL structure and SEO implications
Beyond Posts and Pages
WordPress comes with two content types: posts (for blog-style content) and pages (for static content). But what about events? Team members? Products? Case studies? Locations? Forcing these into posts or pages creates organizational chaos.
Custom post types let you create distinct content types with their own admin sections, URL structures, and features. Custom taxonomies let you classify this content. Together, they transform WordPress from a blog platform into a flexible content management system.
Content Architecture
Custom post types are an architectural decision. Before creating them, think through your content model. What content types exist? How do they relate? How will editors manage them? Good architecture makes sites maintainable; poor architecture creates long-term problems.
When to Use Custom Post Types
Good Candidates for Custom Post Types
- Distinct content types: Events, products, team members, testimonials
- Different data structures: Content needing unique fields
- Separate management: Content managed by different teams
- Unique display needs: Content requiring special templates
- Independent archives: Content with its own listing pages
When Regular Posts Work
- Blog articles and news
- Content that fits the standard post model
- Content where categories provide sufficient organization
| Content Type | Recommendation | Why |
|---|---|---|
| Blog posts | Use posts | Standard post functionality fits |
| Team members | Custom post type | Different fields, separate management |
| Events | Custom post type | Date-based display, unique templates |
| Case studies | Custom post type | Portfolio-style, distinct structure |
| News articles | Use posts | Standard chronological content |
| Locations | Custom post type | Unique fields, map integration |
Creating Custom Post Types
Using Code
function register_team_post_type() {
$labels = array(
'name' => 'Team Members',
'singular_name' => 'Team Member',
'add_new_item' => 'Add New Team Member',
'edit_item' => 'Edit Team Member',
'all_items' => 'All Team Members',
'search_items' => 'Search Team Members',
);
$args = array(
'labels' => $labels,
'public' => true,
'has_archive' => true,
'rewrite' => array( 'slug' => 'team' ),
'supports' => array( 'title', 'editor', 'thumbnail' ),
'menu_icon' => 'dashicons-groups',
'show_in_rest' => true, // Enables block editor
);
register_post_type( 'team_member', $args );
}
add_action( 'init', 'register_team_post_type' );
Key Arguments
- public: Show in admin and frontend
- has_archive: Create archive page for this type
- rewrite: URL structure (slug)
- supports: Features enabled (title, editor, thumbnail, etc.)
- show_in_rest: Enable block editor support
- menu_icon: Admin menu icon
Using Plugins
Plugins like Custom Post Type UI provide visual interfaces for creating post types without code. Good for simple cases, but code provides more flexibility.
Flush Permalinks
Custom Taxonomies
Taxonomies organize and classify content. Categories and tags are built-in taxonomies for posts. Custom taxonomies extend this to any post type.
Hierarchical vs. Non-Hierarchical
- Hierarchical (like categories): Parent-child relationships, checkboxes in admin
- Non-hierarchical (like tags): Flat list, free-form entry
Creating Custom Taxonomy
function register_department_taxonomy() {
$labels = array(
'name' => 'Departments',
'singular_name' => 'Department',
'search_items' => 'Search Departments',
'all_items' => 'All Departments',
'parent_item' => 'Parent Department',
'add_new_item' => 'Add New Department',
);
$args = array(
'hierarchical' => true, // Like categories
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'rewrite' => array( 'slug' => 'department' ),
'show_in_rest' => true,
);
register_taxonomy( 'department', array( 'team_member' ), $args );
}
add_action( 'init', 'register_department_taxonomy' );
Taxonomy Design
Think carefully about taxonomy structure. Too many taxonomies confuse editors. Too few limit organization. Hierarchical taxonomies work for clear categories; flat taxonomies work for flexible tagging.
Shared Taxonomies
Taxonomies can be shared across post types. A "Location" taxonomy might apply to both events and team members, creating connections between content types.
Custom Fields
Custom post types often need custom fields—event dates, team member titles, product prices.
Options for Custom Fields
- Advanced Custom Fields (ACF): Most popular, extensive field types
- Meta Box: Similar to ACF, developer-friendly
- Custom Metaboxes (CMB2): Code-based approach
- Native custom fields: Basic but limited UI
Field Design Considerations
- Keep the editor interface simple
- Group related fields logically
- Use appropriate field types (don't put dates in text fields)
- Consider which fields are required vs. optional
Templates and Display
Template Hierarchy
WordPress looks for templates in order:
single-{post_type}.phpfor single itemsarchive-{post_type}.phpfor archivestaxonomy-{taxonomy}.phpfor taxonomy archives
Querying Custom Post Types
$team_query = new WP_Query( array(
'post_type' => 'team_member',
'posts_per_page' => 12,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'department',
'field' => 'slug',
'terms' => 'engineering',
),
),
) );
Structure for Success
Custom post types and taxonomies are powerful tools for organizing complex content. Used well, they create intuitive editorial experiences and clean, manageable code. Plan your content architecture thoughtfully, implement carefully, and your WordPress site can handle sophisticated content structures.
Start with clear requirements: What content types exist? How should they be organized? What fields do they need? Then build the architecture that serves those needs cleanly.
Frequently Asked Questions
Should I use a plugin or code custom post types myself?
What's the difference between categories and taxonomies?
Can I convert existing posts to a custom post type?
Do custom post types affect performance?
Need help with WordPress content architecture?
I help organizations design and implement WordPress content structures that scale. Let's discuss your content management needs.