Ask any question about WordPress here... and get an instant response.
Post this Question & Answer:
How can I add a custom post type without using a plugin?
Asked on Jan 09, 2026
Answer
To add a custom post type in WordPress without using a plugin, you need to register it using the `register_post_type` function in your theme's `functions.php` file. This allows you to create a new type of content that behaves similarly to posts and pages.
<!-- BEGIN COPY / PASTE -->
function create_custom_post_type() {
$args = array(
'labels' => array(
'name' => 'Books',
'singular_name' => 'Book'
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'books'),
'supports' => array('title', 'editor', 'thumbnail')
);
register_post_type('book', $args);
}
add_action('init', 'create_custom_post_type');
<!-- END COPY / PASTE -->Additional Comment:
- Place the code snippet in your theme's `functions.php` file.
- Adjust the `labels` and `supports` arrays to fit your custom post type needs.
- Ensure that your theme is active, as deactivating it will disable the custom post type.
- Visit the WordPress dashboard and check for the new "Books" menu item to manage your custom posts.
Recommended Links:
