{"id":1751,"date":"2016-08-05T18:39:40","date_gmt":"2016-08-05T18:39:40","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=1751"},"modified":"2016-08-05T18:41:44","modified_gmt":"2016-08-05T18:41:44","slug":"wordpress-custom-post-types-without-plugin","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/","title":{"rendered":"How to Create Custom Post Types in WordPress without using Plugin"},"content":{"rendered":"<p>WordPress has many different content types. A single item of content is called a post, also post is a specific post type. All the post types are stored in the same database table (<code>wp_posts<\/code>) and differentiated by a column called <code>post_type<\/code>.  By default, five post types are available in WordPress.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Post (Post Type: &#8216;post&#8217;)<\/li>\n<li>Page (Post Type: &#8216;page&#8217;)<\/li>\n<li>Attachment (Post Type: &#8216;attachment&#8217;)<\/li>\n<li>Revision (Post Type: &#8216;revision&#8217;)<\/li>\n<li>Navigation menu (Post Type: &#8216;nav_menu_item&#8217;)<\/li>\n<\/ul>\n<p>Also, you can create new post types which are called Custom Post Types. A custom post type can be added to WordPress using <code>register_post_type()<\/code> function. It very simple and you don&#8217;t need to use any plugin for that, you can register your custom post types without using Plugin.<\/p>\n<p>In this article, we&#8217;ll show you how to create custom post types in WordPress. Also, you&#8217;ll know how to add taxonomy or category of custom post types in WordPress. WordPress custom post type helps you to divide up your website content in a more structured way. For example, your website offers some products to users and you want to separate the products section from the posts section. In that case, you would probably need a separate product post type. This custom post type will have its own custom category and custom fields.<\/p>\n<h2>Create Custom Post Type<\/h2>\n<p>The <code>register_post_type()<\/code> function is used to create a post type and it only be invoked through the <code>init<\/code> action. At the time of creating a post type, always register taxonomies of that post type. You can define and register a taxonomy using <code>register_taxonomy()<\/code> function.<\/p>\n<p>You only need to modify your current theme&#8217;s <code>functions.php<\/code> file. Open the <code>\/wp-content\/themes\/theme_name\/functions.php<\/code> file and place the following code in this file.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;Product&nbsp;Custom&nbsp;Post&nbsp;Type<br \/><\/span><span style=\"color: #007700\">function&nbsp;<\/span><span style=\"color: #0000BB\">product_init<\/span><span style=\"color: #007700\">()&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;set&nbsp;up&nbsp;product&nbsp;labels<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$labels&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'name'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Products'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'singular_name'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Product'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'add_new'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Add&nbsp;New&nbsp;Product'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'add_new_item'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Add&nbsp;New&nbsp;Product'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'edit_item'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Edit&nbsp;Product'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'new_item'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'New&nbsp;Product'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'all_items'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'All&nbsp;Products'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'view_item'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'View&nbsp;Product'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'search_items'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Search&nbsp;Products'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'not_found'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'No&nbsp;Products&nbsp;Found'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'not_found_in_trash'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'No&nbsp;Products&nbsp;found&nbsp;in&nbsp;Trash'<\/span><span style=\"color: #007700\">,&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'parent_item_colon'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">''<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'menu_name'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Products'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;register&nbsp;post&nbsp;type<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$args&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'labels'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$labels<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'public'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'has_archive'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'show_ui'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'capability_type'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'post'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'hierarchical'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'rewrite'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;array(<\/span><span style=\"color: #DD0000\">'slug'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'product'<\/span><span style=\"color: #007700\">),<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'query_var'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'menu_icon'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'dashicons-randomize'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'supports'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'title'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'editor'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'excerpt'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'trackbacks'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'custom-fields'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'comments'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'revisions'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'thumbnail'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'author'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'page-attributes'<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">register_post_type<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #DD0000\">'product'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$args&nbsp;<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;register&nbsp;taxonomy<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">register_taxonomy<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'product_category'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'product'<\/span><span style=\"color: #007700\">,&nbsp;array(<\/span><span style=\"color: #DD0000\">'hierarchical'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'label'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Category'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'query_var'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'rewrite'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;array(&nbsp;<\/span><span style=\"color: #DD0000\">'slug'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'product-category'&nbsp;<\/span><span style=\"color: #007700\">)));<br \/>}<br \/><\/span><span style=\"color: #0000BB\">add_action<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #DD0000\">'init'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'product_init'&nbsp;<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<p><b>register_post_type() function:<\/b><\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;register_post_type<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #0000BB\">$post_type<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$args&nbsp;<\/span><span style=\"color: #007700\">);&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<p><code>register_post_type()<\/code> function accepts two parameters, <code>$post_type<\/code> and <code>$args<\/code>.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>$post_type \u2013 Specify your custom post type.<\/li>\n<li>$args \u2013 An array of the arguments.<\/li>\n<\/ul>\n<p><b>register_taxonomy() function:<\/b><\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php&nbsp;register_taxonomy<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #0000BB\">$taxonomy<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$object_type<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$args&nbsp;<\/span><span style=\"color: #007700\">);&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<p><code>register_taxonomy()<\/code> function accepts three parameters, <code>$taxonomy<\/code>, <code>$object_type<\/code>, and <code>$args<\/code>.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>$taxonomy \u2013 The Name of the taxonomy.<\/li>\n<li>$object_type \u2013 The name of the object type for the taxonomy object.<\/li>\n<li>$args \u2013 An array of the arguments.<\/li>\n<\/ul>\n<p><code>register_post_type<\/code> and <code>register_taxonomy<\/code> both function accept the following arguments in <code>$args<\/code> parameter.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>label &#8211; A plural descriptive name for the post type.<\/li>\n<li>labels &#8211; An array of labels for the post type.<\/li>\n<li>description \u2013 A short description of the post type.<\/li>\n<li>public \u2013 Visibility control for authors and readers.<\/li>\n<li>show_ui \u2013 Whether generates a default UI for this post type in the admin panel.<\/li>\n<li>show_in_nav_menus \u2013 Whether the post type is available in the navigation menu.<\/li>\n<li>show_in_menu \u2013 Whether the post type would appear in the admin menu.<\/li>\n<li>show_in_admin_bar \u2013 Whether the post type available in the admin bar.<\/li>\n<li>menu_position \u2013 The position of the post type in menu order.<\/li>\n<li>menu_icon &#8211; Specify the menu icon.<\/li>\n<li>capability_type \u2013 The string is used to build the read, edit, and delete capabilities.<\/li>\n<li>capabilities \u2013 An array of the capabilities for the post type.<\/li>\n<li>map_meta_cap \u2013 Whether the internal default meta capability handling is used.<\/li>\n<li>hierarchical \u2013 Whether the post type is hierarchical.<\/li>\n<li>supports \u2013 An alias for calling add_post_type_support() directly.<\/li>\n<li>register_meta_box_cb \u2013 Provide a callback function that will be called when setting up the meta boxes for the edit form.<\/li>\n<li>taxonomies \u2013 An array of registered taxonomies.<\/li>\n<li>has_archive \u2013 Enables the post type archives.<\/li>\n<li>permalink_epmask \u2013 The default rewrite endpoint bitmasks.<\/li>\n<li>rewrite \u2013 Triggers the handling of rewrites for the post type.<\/li>\n<li>query_var \u2013 Sets the query_var for the post type.<\/li>\n<li>can_export \u2013 Can the post type be exported.<\/li>\n<li>show_in_rest \u2013 Whether the post type is expose in REST API.<\/li>\n<li>rest_base \u2013 The base slug while accessed using the REST API.<\/li>\n<li>rest_controller_class &#8211; An optional custom controller to use instead of WP_REST_Posts_Controller.<\/li>\n<li>_builtin \u2013 Whether the post type is native or &#8220;built-in&#8221;.<\/li>\n<li>_edit_link \u2013 Link to edit an entry with the post.<\/li>\n<\/ul>\n<p>After inserting our example code in <code>function.php<\/code> file of your current WordPress theme, you&#8217;ll see the <b>Products<\/b> menu appears on the left side menu panel in WordPress admin panel. This custom post type menu allows you to view, add, edit, delete separate contents for the custom post type. Also, you would able to add and manage custom post type categories.<\/p>\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/products-custom-post-type-wordpress-codexworld.png\" alt=\"products-custom-post-type-wordpress-codexworld\" width=\"619\" height=\"453\" class=\"alignnone size-full wp-image-1754\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/products-custom-post-type-wordpress-codexworld.png 619w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/products-custom-post-type-wordpress-codexworld-300x220.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/products-custom-post-type-wordpress-codexworld-200x146.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/products-custom-post-type-wordpress-codexworld-314x230.png 314w\" sizes=\"auto, (max-width: 619px) 100vw, 619px\" \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>WordPress has many different content types. A single item of content is called a post, also post is a specific post type. All the post types are stored in the same database table (wp_posts) and <\/p>\n","protected":false},"author":1,"featured_media":1752,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[25],"class_list":["post-1751","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-wordpress","cat-5-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create Custom Post Types in WordPress without using Plugin - CodexWorld<\/title>\n<meta name=\"description\" content=\"WordPress Custom Post Types \u2013 Step-by-step tutorial on how to create custom post types and taxonomies in WordPress without using any plugin.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Custom Post Types in WordPress without using Plugin - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"WordPress Custom Post Types \u2013 Step-by-step tutorial on how to create custom post types and taxonomies in WordPress without using any plugin.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-05T18:39:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-08-05T18:41:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"How to Create Custom Post Types in WordPress without using Plugin\",\"datePublished\":\"2016-08-05T18:39:40+00:00\",\"dateModified\":\"2016-08-05T18:41:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/\"},\"wordCount\":702,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png\",\"keywords\":[\"WordPress\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/\",\"name\":\"How to Create Custom Post Types in WordPress without using Plugin - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png\",\"datePublished\":\"2016-08-05T18:39:40+00:00\",\"dateModified\":\"2016-08-05T18:41:44+00:00\",\"description\":\"WordPress Custom Post Types \u2013 Step-by-step tutorial on how to create custom post types and taxonomies in WordPress without using any plugin.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/08\\\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"create-custom-post-types-in-wordpress-without-plugin-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-custom-post-types-without-plugin\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create Custom Post Types in WordPress without using Plugin\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create Custom Post Types in WordPress without using Plugin - CodexWorld","description":"WordPress Custom Post Types \u2013 Step-by-step tutorial on how to create custom post types and taxonomies in WordPress without using any plugin.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Custom Post Types in WordPress without using Plugin - CodexWorld","og_description":"WordPress Custom Post Types \u2013 Step-by-step tutorial on how to create custom post types and taxonomies in WordPress without using any plugin.","og_url":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2016-08-05T18:39:40+00:00","article_modified_time":"2016-08-05T18:41:44+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"How to Create Custom Post Types in WordPress without using Plugin","datePublished":"2016-08-05T18:39:40+00:00","dateModified":"2016-08-05T18:41:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/"},"wordCount":702,"commentCount":7,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png","keywords":["WordPress"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/","url":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/","name":"How to Create Custom Post Types in WordPress without using Plugin - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png","datePublished":"2016-08-05T18:39:40+00:00","dateModified":"2016-08-05T18:41:44+00:00","description":"WordPress Custom Post Types \u2013 Step-by-step tutorial on how to create custom post types and taxonomies in WordPress without using any plugin.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png","width":1366,"height":768,"caption":"create-custom-post-types-in-wordpress-without-plugin-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/wordpress-custom-post-types-without-plugin\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"How to Create Custom Post Types in WordPress without using Plugin"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/08\/create-custom-post-types-in-wordpress-without-plugin-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-sf","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=1751"}],"version-history":[{"count":5,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1751\/revisions"}],"predecessor-version":[{"id":1758,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1751\/revisions\/1758"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/1752"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=1751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=1751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=1751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}