Ask any question about WordPress here... and get an instant response.
Post this Question & Answer:
How can I create a custom post type with specific taxonomies in WordPress?
Asked on Jan 23, 2026
Answer
Creating a custom post type with specific taxonomies in WordPress involves using the `register_post_type` and `register_taxonomy` functions. This process allows you to organize content types beyond the default posts and pages.
<!-- BEGIN COPY / PASTE -->
function my_custom_post_type() {
// Register Custom Post Type
register_post_type('custom_type', array(
'labels' => array(
'name' => __('Custom Types'),
'singular_name' => __('Custom Type')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'custom-types'),
'supports' => array('title', 'editor', 'thumbnail'),
));
// Register Custom Taxonomy
register_taxonomy('custom_taxonomy', 'custom_type', array(
'labels' => array(
'name' => __('Custom Taxonomies'),
'singular_name' => __('Custom Taxonomy')
),
'hierarchical' => true,
'rewrite' => array('slug' => 'custom-taxonomy'),
));
}
add_action('init', 'my_custom_post_type');
<!-- END COPY / PASTE -->Additional Comment:
- Place the code in your theme's `functions.php` file or in a custom plugin to ensure it runs on initialization.
- Customize the labels and slugs to match your content needs.
- Ensure permalinks are refreshed (Settings → Permalinks) after adding new post types or taxonomies.
- Consider using a plugin like "Custom Post Type UI" for a user-friendly interface to manage custom post types and taxonomies.
Recommended Links:
