Table of Contents
Most popular website builder. 43% of the web is built up on WordPress. New bloggers, small businesses, and Fortune 500 companies use WordPress more than all other options combined. Join the lots of people who call WordPress.com home.
How to create custom post types in WordPress without plugins: WordPress has many different types of content. But, a single content is called a specific type of post.
However, we can store all post types in the same database table (posts) and change them by post type column.
By default, How To Create Custom Post Type In WordPress Without 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”)
And also, you could create a new type, 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. And also, 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 more structured way.
For example, your website offers some good products to users. You also want different products from the mail section.
In that case, you probably need a different product post type. So, this custom post type has its category and custom fields.
How To Create Custom post type in WordPress without plugin-Create a Custom Post Type
On the other hand, the register_post_type () function creates a post type, and we can only call it through the init action.
Therefore, consistently record the taxonomies for that post type when creating one. 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. After that, open the file /wp-content/themes/theme_name/functions.php and paste the following code.
register_post_type() function accepts the two parameters, $post_type and $args.
$post_type – However, 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.
Meanwhile, register_post_type and register_taxonomy accept the following arguments in the $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 publication type 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.
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.
But, 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.
However, this custom post type menu allows users to view, add, edit, and delete change content for several post types. You can also add and manage categories of custom post types.
Related Searches how to create custom post type in WordPress without a plugin
[How to create a 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 without plugin step by-step]
[how to create custom post type in WordPress without plugin get custom post type data in wordpress]
[how to edit custom post type in wordpress]
[Portfolio how to create custom post type in WordPress without plugin post type wordpress]
[how to create custom post type in WordPress without plugin change]
[how to create custom post type in WordPress without plugin category in wordpress]
[how to create custom post type in WordPress without plugin plugin]
[how to create custom post type in WordPress without plugin post]
Also Read: Technology Web Design