How to create custom post type in wordpress without plugin: WordPress has many different types of content. A single piece of content is called a post, and the post is also a specific type of post.

We can store all post types in the same database table (wp_posts) and differentiated by a column named post_type.

By default, How To Create Custom Post Type In WordPress Without A Plugin, there are five types of posts available in WordPress.

Contribution (type of contribution: ‘Contribution’)

Page (type of publication: “Page”)

Attachment (entry type: “Attachment”)

Review (entry type: “review”)

Navigation menu (post type: “nav_menu_item”)

You can also create new post types, known as custom post types. Also, a custom post type can be added to WordPress using the register_post_type () function.

Also, it is straightforward, and you don’t need to use a plugin for it. You can register the custom post types without using the plugin.

Then, in this article, we show you how to create custom post types in WordPress.

Also, you will know how to add a taxonomy or category of custom post types in WordPress. WordPress custom post type helps you break up your website content in a more structured way.

For example, your website offers some good products to users; also, you want to separate the products section from the mail section.

In that case, you probably need a different product post type. This custom post type has its category and custom fields.

Create a Custom Post Type

The register_post_type () function creates a post type, and we can only call it through the init action.

When creating a post type, always record the taxonomies for that post type. You can define and register a taxonomy with the register_taxonomy () function.

All you have to do is change the functions.php file of your current theme. Open the file /wp-content/themes/theme_name/functions.php and paste the following code into that file.

how to create custom post type in wordpress without plugin


register_post_type() function:

register_post_type() function accepts the two parameters, $post_type and $args.

$post_type – It specifies your custom post type.
$args – An array of the arguments.

register_taxonomy() function:

register_taxonomy() function accepts three parameters, $taxonomy, $object_type, and $args.

$args – An array of the arguments.

$taxonomy – It is the name of the taxonomy.

$object_type – It is the name of the object type for the taxonomy object.

register_post_type and register_taxonomy both functions accept the following arguments in $args parameter.


Label: a descriptive plural name for the post type.

Tags – An array of titles for the post type.

Description: a brief description of the type of publication

Public: Visibility control for authors and readers.

show_ui: if it generates a standard user interface for this type of publication in the admin panel.

show_in_nav_menus: if the post type is available in the navigation menu.

show_in_menu: if the type of publication appears in the administration menu.

show_in_admin_bar: if the post type is available in the admin bar.

menu_position: the position of the post type in the menu order.

menu_icon: Specify the menu icon.

Capacity_type – We use the string to create the read, edit and delete functions.

Skills – A set of skills for the Post Type

map_meta_cap – Whether to use standard internal meta capacity handling.

Hierarchical: if the publication type is hierarchical.

supported: an alias to call add_post_type_support () directly.

register_meta_box_cb – Provides a callback function called when meta boxes are set up for the edit form.

Taxonomies: a set of registered taxonomies.

has_archive – enables post-type files.

permalink_epmask – The standard bitmasks used for rewriting endpoints.

Post Types

Rewrite: activates the rewrite handling for the post type.

query_var: sets query_var for the post type.

can_export: The publication type can be exported.

show_in_rest: if the post type is made available in the REST API.

rest_base: the base slug when accessing via the REST API.

rest_controller_class – It is an optional custom controller to be used in place of WP_REST_Posts_Controller.

_builtin: if the post type is native or “built-in.”

_edit_link: Link to edit an entry with the publication.

After you’ve added our sample code to the function.php file of your current WordPress theme, the Products menu will appear in the left menu area of the WordPress admin area.

This custom post type menu allows the user to view, add, edit, and delete different content for the custom post type. You can also add and manage categories of custom post types.

Related Searches

[how to add custom field in custom post type in wordpress without plugin]

[wordpress create custom post type programmatically]

[how to display custom post type in wordpress]

[how to create custom post type in wordpress step by-step]

[how to get custom post type data in wordpress]

[how to edit custom post type in wordpress]

[portfolio custom post type wordpress]

[how to create custom post type category in wordpress]




Also Read: Technology Web Design

Review How To Create Custom Post Type In WordPress Without A Plugin.

Your email address will not be published. Required fields are marked *