{"id":144,"date":"2014-06-26T21:56:56","date_gmt":"2014-06-27T02:56:56","guid":{"rendered":"http:\/\/etapien.com\/guides\/?p=144"},"modified":"2020-08-24T14:22:21","modified_gmt":"2020-08-24T19:22:21","slug":"create-custom-post-types-wordpress","status":"publish","type":"post","link":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/","title":{"rendered":"How to Create Custom Post Types in WordPress"},"content":{"rendered":"<p style=\"color: #464646;\">Over the past years, WordPress has evolved into a robust content management system. By default WordPress comes with post and pages as the main content types. However you can create as many custom content types as you like, and these custom content types are referred to as\u00a0<strong>Custom Post Types<\/strong>. In this article, this guide\u00a0will show you how to create custom post types in WordPress. This guide\u00a0will also show you how to use them like a pro.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">What is Custom Post Type in WordPress?<\/h4>\n<p style=\"color: #464646;\">Custom post types are content types like posts and pages. Since WordPress evolved from a simple blogging platform into a robust CMS, the term post stuck to it. However, a post type can be any kind of content. By default, WordPress comes with these post types:<\/p>\n<ul style=\"color: #464646;\">\n<li>Post<\/li>\n<li>Page<\/li>\n<li>Attachment<\/li>\n<li>Revision<\/li>\n<li>Nav Menu<\/li>\n<\/ul>\n<p style=\"color: #464646;\">You can create your own custom post types and call them whatever you want. For example if you run a movie review website, then you would probably want to create a movie reviews post type. This post type can have different custom fields and even its own custom category structure. Other examples of post types are: Portfolio, Testimonials, Products, etc.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Creating a Custom Post Type \u2013 The Easy Way<\/h4>\n<p style=\"color: #464646;\">The easiest way to create a custom post type in WordPress is by using a plugin. This method is recommended for beginner because it is safe and super easy.<\/p>\n<p style=\"color: #464646;\">First thing you need to do is install and activate the\u00a0Custom Post Type UI\u00a0plugin. Upon activation, the plugin will add a new menu item in your WordPress admin menu called\u00a0<em>CPT UI<\/em>.<\/p>\n<p style=\"color: #464646;\">Now go to\u00a0<strong>CPT UI \u00bb Add New<\/strong>\u00a0to create a new custom post type.<\/p>\n<p style=\"color: #464646;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21425\" title=\"Custom Post UI plugin's Add New Page\" src=\"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png\" alt=\"Custom Post UI plugin's Add New Page\" width=\"520\" height=\"289\" \/><\/p>\n<p style=\"color: #464646;\">The Custom Post Type UI plugin also allows you to create\u00a0custom taxonomies.<\/p>\n<p style=\"color: #464646;\">This is why the Add new custom post type page is divided into two columns. On your left, you have the form you need to fill to create your custom post type. On your right, you have a form to create a custom taxonomy if you need one.<\/p>\n<p style=\"color: #464646;\">In the custom post type column, first you need to provide a name for your custom post type. This name cannot exceed more than 20 characters, e.g. movies, recipe, deal, glossary, etc.<\/p>\n<p style=\"color: #464646;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-21426\" title=\"Adding your new custom post type\" src=\"http:\/\/cdn3.wpbeginner.com\/wp-content\/uploads\/2014\/06\/new-cpt.png\" alt=\"Adding your new custom post type\" width=\"520\" height=\"315\" \/><\/p>\n<p style=\"color: #464646;\">In the next field, you need to provide a label for your custom post type. This label will appear in your WordPress admin bar just like posts and pages. It also needs to be plural to make sense. e.g. Movies, Recipes, Deals, Glossary, etc.<\/p>\n<p style=\"color: #464646;\">After that you need to provide a singular form for your label. This singular form will be used by WordPress to show instructions and other user interface elements.<\/p>\n<p style=\"color: #464646;\">Lastly enter a description for your custom post type. This description is simply used to describe what your post type does.<\/p>\n<p style=\"color: #464646;\">Now you can click on the \u2018Create Custom Post Type\u2019 button to add your new custom post type. That\u2019s all.<\/p>\n<p style=\"color: #464646;\">You can also click on the Advanced Label Options and Advanced Options links to customize more options for your custom post type.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Creating a Custom Post Type Manually<\/h4>\n<p style=\"color: #464646;\">The problem with using a plugin is that your custom post types will disappear when the plugin is deactivated. Any data you have in those custom post types will still be there, but your custom post type will be unregistered and will not be accessible from the\u00a0admin area.<\/p>\n<p style=\"color: #464646;\">If you are working on a client site and do not want to install another plugin, then you can manually create your custom post type by adding the required code in your theme\u2019s\u00a0functions.php\u00a0file or in a\u00a0site-specific plugin\u00a0(See:\u00a0Custom Post Types Debate functions.php or Plugin).<\/p>\n<p style=\"color: #464646;\">First we will show you a quick and fully working example so that you understand how it works. Take a look at this code:<\/p>\n<div id=\"highlighter_627363\" class=\"syntaxhighlighter  \" style=\"color: #464646;\">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<pre style=\"color: #000000;\">\/\/ Our custom post type function\r\nfunction create_posttype() {\r\n\r\n\tregister_post_type( 'movies',\r\n\t\/\/ CPT Options\r\n\t\tarray(\r\n\t\t\t'labels' =&gt; array(\r\n\t\t\t\t'name' =&gt; __( 'Movies' ),\r\n\t\t\t\t'singular_name' =&gt; __( 'Movie' )\r\n\t\t\t),\r\n\t\t\t'public' =&gt; true,\r\n\t\t\t'has_archive' =&gt; true,\r\n\t\t\t'rewrite' =&gt; array('slug' =&gt; 'movies'),\r\n\t\t)\r\n\t);\r\n}\r\n\/\/ Hooking up our function to theme setup\r\nadd_action( 'init', 'create_posttype' );<\/pre>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">What this code does is that it registers a post type\u00a0<\/span><code style=\"line-height: 1.714285714;\">'movies'<\/code><span style=\"line-height: 1.714285714; font-size: 1rem;\">\u00a0with an array of arguments. These arguments are the options of our custom post type. This array has two parts, the first part is labels, which itself is an array. The second part contains other arguments like public visibility, has archive, and slug that will be used in URLs for this post type.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"color: #464646;\">Now lets take a look at a detailed piece of code that adds more options to your custom post type.<\/p>\n<div id=\"highlighter_748993\" class=\"syntaxhighlighter  \" style=\"color: #464646;\">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<pre style=\"color: #000000;\">\/*\r\n* Creating a function to create our CPT\r\n*\/\r\n\r\nfunction custom_post_type() {\r\n\r\n\/\/ Set UI labels for Custom Post Type\r\n\t$labels = array(\r\n\t\t'name'                =&gt; _x( 'Movies', 'Post Type General Name', 'twentythirteen' ),\r\n\t\t'singular_name'       =&gt; _x( 'Movie', 'Post Type Singular Name', 'twentythirteen' ),\r\n\t\t'menu_name'           =&gt; __( 'Movies', 'twentythirteen' ),\r\n\t\t'parent_item_colon'   =&gt; __( 'Parent Movie', 'twentythirteen' ),\r\n\t\t'all_items'           =&gt; __( 'All Movies', 'twentythirteen' ),\r\n\t\t'view_item'           =&gt; __( 'View Movie', 'twentythirteen' ),\r\n\t\t'add_new_item'        =&gt; __( 'Add New Movie', 'twentythirteen' ),\r\n\t\t'add_new'             =&gt; __( 'Add New', 'twentythirteen' ),\r\n\t\t'edit_item'           =&gt; __( 'Edit Movie', 'twentythirteen' ),\r\n\t\t'update_item'         =&gt; __( 'Update Movie', 'twentythirteen' ),\r\n\t\t'search_items'        =&gt; __( 'Search Movie', 'twentythirteen' ),\r\n\t\t'not_found'           =&gt; __( 'Not Found', 'twentythirteen' ),\r\n\t\t'not_found_in_trash'  =&gt; __( 'Not found in Trash', 'twentythirteen' ),\r\n\t);\r\n\t\r\n\/\/ Set other options for Custom Post Type\r\n\t\r\n\t$args = array(\r\n\t\t'label'               =&gt; __( 'movies', 'twentythirteen' ),\r\n\t\t'description'         =&gt; __( 'Movie news and reviews', 'twentythirteen' ),\r\n\t\t'labels'              =&gt; $labels,\r\n\t\t\/\/ Features this CPT supports in Post Editor\r\n\t\t'supports'            =&gt; array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),\r\n\t\t\/\/ You can associate this CPT with a taxonomy or custom taxonomy. \r\n\t\t'taxonomies'          =&gt; array( 'genres' ),\r\n\t\t\/* A hierarchical CPT is like Pages and can have\r\n\t\t* Parent and child items. A non-hierarchical CPT\r\n\t\t* is like Posts.\r\n\t\t*\/\t\r\n\t\t'hierarchical'        =&gt; false,\r\n\t\t'public'              =&gt; true,\r\n\t\t'show_ui'             =&gt; true,\r\n\t\t'show_in_menu'        =&gt; true,\r\n\t\t'show_in_nav_menus'   =&gt; true,\r\n\t\t'show_in_admin_bar'   =&gt; true,\r\n\t\t'menu_position'       =&gt; 5,\r\n\t\t'can_export'          =&gt; true,\r\n\t\t'has_archive'         =&gt; true,\r\n\t\t'exclude_from_search' =&gt; false,\r\n\t\t'publicly_queryable'  =&gt; true,\r\n\t\t'capability_type'     =&gt; 'page',\r\n\t);\r\n\t\r\n\t\/\/ Registering your Custom Post Type\r\n\tregister_post_type( 'movies', $args );\r\n\r\n}\r\n\r\n\/* Hook into the 'init' action so that the function\r\n* Containing our post type registration is not \r\n* unnecessarily executed. \r\n*\/\r\n\r\nadd_action( 'init', 'custom_post_type', 0 );\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">As you can see, we have added many more options to the custom post type with his code. It will add more features like support for revisions, featured image, custom fields, etc.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p style=\"color: #464646;\">We have also associated this custom post type with a custom taxonomy called genres. Also notice the part where we have set the hierarchical value to be false. If you would like your custom post type to behave like Pages, then you can set this value to true.<\/p>\n<p style=\"color: #464646;\">Also notice repeated usage of twentythirteen, this is called text domain. If your theme is\u00a0translation ready\u00a0and you want your custom post types to be translated, then you will need to mention text domain used by your theme. You can find your theme\u2019s text domain inside\u00a0<code>style.css<\/code>\u00a0file in your theme directory. Text domain will be mentioned in the header of the file.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Displaying Custom Post Types on Your Site<\/h4>\n<p style=\"color: #464646;\">WordPress comes with built in support for displaying your custom post types. Once you have added a few items into your new custom post type, it is time to display them on your website.<\/p>\n<p style=\"color: #464646;\">There are a couple of methods that you can use, each one has its own benefits.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Displaying Custom Post Type Using Default Archive Template<\/h4>\n<p style=\"color: #464646;\">First you can simply go to\u00a0<strong>Appearance \u00bb Menus<\/strong>\u00a0and add a custom link to your menu. This custom link is the link to your custom post type. If you are using\u00a0SEO friendly permalinks\u00a0then your CPT\u2019s URL will most likely be something like this:<\/p>\n<p style=\"color: #464646;\"><code>http:\/\/example.com\/movies<\/code><\/p>\n<p style=\"color: #464646;\">If you are not using SEO friendly\u00a0permalinks, then your custom post type URL will be something like this:<\/p>\n<p style=\"color: #464646;\"><code>http:\/\/example.com\/?post_type=movies<\/code><\/p>\n<p style=\"color: #464646;\">Replace example.com with your own domain name and movies with your custom post type name. Save your menu and then visit the front-end of your website. You will see the new menu you added, and when you click on it, it will display your custom post type archive page using the archive.php template file in your theme.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Using Custom Templates for CPT Archives and Single Entries<\/h4>\n<p style=\"color: #464646;\">If you don\u2019t like the appearance of the archive page for your custom post type, then you can use dedicated\u00a0template for custom post type archive. To do that all you need to do is create a new file in your theme directory and name it\u00a0<code>archive-movies.php<\/code>. Replace movies with the name of your custom post type.<\/p>\n<p style=\"color: #464646;\">For geting started, you can copy the contents of your theme\u2019s\u00a0<code>archive.php<\/code>\u00a0file into<code>archive-movies.php<\/code>\u00a0template and then start modifying it to meet your needs. Now whenever the archive page for your custom post type is accessed, this template will be used to display it.<\/p>\n<p style=\"color: #464646;\">Similarly, you can also create a custom template for your post type\u2019s single entry display. To do that you need to create\u00a0<code>single-movies.php<\/code>\u00a0in your theme directory. Don\u2019t forget to replace movies with the name of your custom post type.<\/p>\n<p style=\"color: #464646;\">You can get started by copying the contents of your theme\u2019s\u00a0<code>single.php<\/code>\u00a0template into\u00a0<code>single-movies.php<\/code>\u00a0template and then start modifying it to meet your needs.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Displaying Custom Post Types on The Front Page<\/h4>\n<p style=\"color: #464646;\">One advantage of using custom post types is that it keeps your custom content types away from your regular posts. However, if you would like them to display among your regular post, then you can do so by adding this code into your theme\u2019s functions.php file or a site-specific plugin:<\/p>\n<div id=\"highlighter_522544\" class=\"syntaxhighlighter  \" style=\"color: #464646;\">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<pre style=\"color: #000000;\">add_action( 'pre_get_posts', 'add_my_post_types_to_query' );\r\n\r\nfunction add_my_post_types_to_query( $query ) {\r\n\tif ( is_home() &amp;&amp; $query-&gt;is_main_query() )\r\n\t\t$query-&gt;set( 'post_type', array( 'post', 'movies' ) );\r\n\treturn $query;\r\n}<\/pre>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">Don\u2019t forget to replace\u00a0<\/span><code style=\"line-height: 1.714285714;\">movies<\/code><span style=\"line-height: 1.714285714; font-size: 1rem;\">\u00a0with your custom post type.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Querying Custom Post Types<\/h4>\n<p style=\"color: #464646;\">If you are familiar with the coding and would like to run loop queries in your templates, then here is how to do that (Related:\u00a0What is a Loop?).<\/p>\n<p style=\"color: #464646;\">By querying the database, you can retrieve items from a custom post type.<\/p>\n<div id=\"highlighter_531676\" class=\"syntaxhighlighter  \" style=\"color: #464646;\">\n<div class=\"lines\">\n<div class=\"line alt1\">\n<pre style=\"color: #000000;\">&lt;?php \r\n$args = array( 'post_type' =&gt; 'movies', 'posts_per_page' =&gt; 10 );\r\n$the_query = new WP_Query( $args ); \r\n?&gt;\r\n&lt;?php if ( $the_query-&gt;have_posts() ) : ?&gt;\r\n&lt;?php while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); ?&gt;\r\n&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;\/h2&gt;\r\n&lt;div class=\"entry-content\"&gt;\r\n&lt;?php the_content(); ?&gt; \r\n&lt;\/div&gt;\r\n&lt;?php wp_reset_postdata(); ?&gt;\r\n&lt;?php else:  ?&gt;\r\n&lt;p&gt;&lt;?php _e( 'Sorry, no posts matched your criteria.' ); ?&gt;&lt;\/p&gt;\r\n&lt;?php endif; ?&gt;<\/pre>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">In this code, first we have defined the post type and posts per page in the arguments for our new WP_Query class. After that we ran our query, retrieved the posts and displayed them inside the loop.<\/span><\/p>\n<\/div>\n<\/div>\n<\/div>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">Displaying Custom Post Types in Widgets<\/h4>\n<p style=\"color: #464646;\">You will notice that there is a default\u00a0widget\u00a0in WordPress to display recent posts. But this widget does not allow you to choose a custom post type. What if you wanted to display latest entries from your newly created post type in a widget? There is an easy way to do this.<\/p>\n<p style=\"color: #464646;\">First thing you need to do is install and activate the\u00a0Ultimate Posts Widget\u00a0plugin. Upon activation, simply go to\u00a0<strong>Appearance \u00bb Widgets<\/strong>\u00a0and drag and drop the Ultimate Posts widget to a sidebar.<\/p>\n<p style=\"color: #464646;\">This powerful widget will allow you to show recent posts from any post types. You can also display post excerpt with a read more link or even show a featured image next to post title. Configure the widget by selecting the options you want and by selecting your custom post type. After that save your changes and see the widget in action on your website.<\/p>\n<h4 style=\"font-weight: normal !important; color: #ff6200;\">More Advance Custom Post Type Tweaks<\/h4>\n<p style=\"color: #464646;\">There is so much more that you can do with your custom post types. You can learn to add your\u00a0custom post types in main RSS feed\u00a0or create a\u00a0separate feed for each custom post type. If you are using\u00a0Disqus commenting system, then checkout how to\u00a0disable Disqus for custom post types\u00a0in WordPress.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the past years, WordPress has evolved into a robust content management system. By default WordPress comes with post and pages as the main content types. However you can create as many custom content types as you like, and these custom content types are referred to as\u00a0Custom Post Types. In this article, this guide\u00a0will show [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Create Custom Post Types in WordPress - Tech Howtos<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/\" \/>\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 - Tech Howtos\" \/>\n<meta property=\"og:description\" content=\"Over the past years, WordPress has evolved into a robust content management system. By default WordPress comes with post and pages as the main content types. However you can create as many custom content types as you like, and these custom content types are referred to as\u00a0Custom Post Types. In this article, this guide\u00a0will show [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Tech Howtos\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-27T02:56:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-24T19:22:21+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png\" \/>\n<meta name=\"author\" content=\"Etapien\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Etapien\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/\",\"url\":\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/\",\"name\":\"How to Create Custom Post Types in WordPress - Tech Howtos\",\"isPartOf\":{\"@id\":\"https:\/\/etapien.com\/guides\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png\",\"datePublished\":\"2014-06-27T02:56:56+00:00\",\"dateModified\":\"2020-08-24T19:22:21+00:00\",\"author\":{\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424\"},\"breadcrumb\":{\"@id\":\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#primaryimage\",\"url\":\"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png\",\"contentUrl\":\"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/etapien.com\/guides\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create Custom Post Types in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/etapien.com\/guides\/#website\",\"url\":\"https:\/\/etapien.com\/guides\/\",\"name\":\"Tech Howtos\",\"description\":\"Tech related useful howtos\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/etapien.com\/guides\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424\",\"name\":\"Etapien\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/etapien.com\/guides\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g\",\"caption\":\"Etapien\"},\"url\":\"https:\/\/etapien.com\/guides\/author\/Etapien\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create Custom Post Types in WordPress - Tech Howtos","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:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Custom Post Types in WordPress - Tech Howtos","og_description":"Over the past years, WordPress has evolved into a robust content management system. By default WordPress comes with post and pages as the main content types. However you can create as many custom content types as you like, and these custom content types are referred to as\u00a0Custom Post Types. In this article, this guide\u00a0will show [&hellip;]","og_url":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/","og_site_name":"Tech Howtos","article_published_time":"2014-06-27T02:56:56+00:00","article_modified_time":"2020-08-24T19:22:21+00:00","og_image":[{"url":"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png"}],"author":"Etapien","twitter_misc":{"Written by":"Etapien","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/","url":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/","name":"How to Create Custom Post Types in WordPress - Tech Howtos","isPartOf":{"@id":"https:\/\/etapien.com\/guides\/#website"},"primaryImageOfPage":{"@id":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#primaryimage"},"thumbnailUrl":"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png","datePublished":"2014-06-27T02:56:56+00:00","dateModified":"2020-08-24T19:22:21+00:00","author":{"@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424"},"breadcrumb":{"@id":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#primaryimage","url":"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png","contentUrl":"http:\/\/cdn4.wpbeginner.com\/wp-content\/uploads\/2014\/06\/cpt-ui.png"},{"@type":"BreadcrumbList","@id":"https:\/\/etapien.com\/guides\/create-custom-post-types-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/etapien.com\/guides\/"},{"@type":"ListItem","position":2,"name":"How to Create Custom Post Types in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/etapien.com\/guides\/#website","url":"https:\/\/etapien.com\/guides\/","name":"Tech Howtos","description":"Tech related useful howtos","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/etapien.com\/guides\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/c67f514649b78dbb5ef0c254a0521424","name":"Etapien","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/etapien.com\/guides\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/55021fd8fb4a829ad64ffab0a92d3b90?s=96&d=mm&r=g","caption":"Etapien"},"url":"https:\/\/etapien.com\/guides\/author\/Etapien\/"}]}},"_links":{"self":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/144"}],"collection":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":1,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":145,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/posts\/144\/revisions\/145"}],"wp:attachment":[{"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/etapien.com\/guides\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}