{"id":87824,"date":"2012-10-18T12:51:25","date_gmt":"2012-10-18T10:51:25","guid":{"rendered":"http:\/\/designmodo.com\/?p=87824"},"modified":"2025-11-11T10:01:03","modified_gmt":"2025-11-11T10:01:03","slug":"wordpress-custom-post-types","status":"publish","type":"post","link":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/","title":{"rendered":"Custom Post Types in WordPress"},"content":{"rendered":"<p>WordPress started as a blogging engine to create blogs. As WordPress has gone more and more popular because of its ease of use, flexibility and beautiful user interface there was a need to make WordPress a platform for a wide variety of sites. WordPress as a platform now has great features which can be <span style=\"text-decoration: underline;\">extended and customize<\/span> to create a variety of sites with lots of different functionalities. By default, WordPress provides types like posts and pages.<\/p>\n<p>In this article, we are going to see how we can use the <strong>custom post type feature<\/strong> to create additional custom types to extend the functionality of WordPress.<\/p>\n<h2>Registering the new custom post type<\/h2>\n<p>Now let\u2019s start by registering a new custom type for our site. Here in this article we are going to <span style=\"text-decoration: underline;\">create a plugin which will create a custom type for mobiles<\/span> in which one will be able to store information about different mobiles he wants to display on his site.<\/p>\n<p>To begin with please create a plugin folder in your <em>wp-content\\plugins\\<\/em> called as <em>customposttypedemo<\/em> and in it create a file as customposttypedemo.php as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87831\" title=\"1\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/11.png\" alt=\"\" width=\"600\" height=\"70\" \/><\/p>\n<p>In the file customposttypedemo.php add the plugin header as below:<\/p>\n<p>[php]<br \/>\n&amp;lt;?php<br \/>\n\/*<br \/>\nPlugin Name: Custom Post Type demo<br \/>\nPlugin URI:<br \/>\nDescription: Demonstrates how to use Custom post types<br \/>\nAuthor: Abbas Suterwala for DesignModo<br \/>\nVersion:<br \/>\nAuthor URI:<br \/>\n*\/<\/p>\n<p>[\/php]<\/p>\n<p>Once you have done this you will be able to see your plugin in the plugin list in the WordPress admin. Once we see it there we can activate the plugin as see below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87832\" title=\"2\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/21.png\" alt=\"\" width=\"600\" height=\"90\" \/><\/p>\n<p>Once our plugin is registered we use the <code>register_post_type<\/code> function provided by WordPress to register our Mobiles type.<\/p>\n<p>The <code>register_post_type<\/code> takes two arguments to it which are the <code>post_type<\/code> and <code>args<\/code> which are the arguments which define the characteristic of the post type. There are a lot of arguments defined for <code>register_post_type<\/code> and a complete list can be found at\u00a0<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_post_type\/\">Function Reference\/register post type<\/a>.<\/p>\n<p>Now to register the Mobiles post type lets add the following code to our plugin:<\/p>\n<p>[php]<br \/>\nadd_action( &#8216;init&#8217;, &#8216;create_mobiles_type&#8217; );<br \/>\nfunction create_mobiles_type() {<br \/>\n\tregister_post_type( &#8216;Mobiles&#8217;,<br \/>\n\t\tarray(<br \/>\n\t\t\t&#8216;labels&#8217; =&amp;amp;amp;gt; array(<br \/>\n\t\t\t\t&#8216;name&#8217; =&amp;amp;amp;gt; __( &#8216;Mobiles&#8217; ),<br \/>\n\t\t\t\t&#8216;singular_name&#8217; =&amp;amp;amp;gt; __( &#8216;Mobile&#8217; )<br \/>\n\t\t\t),<br \/>\n\t\t&#8216;public&#8217; =&amp;amp;amp;gt; true,<br \/>\n\t\t&#8216;has_archive&#8217; =&amp;amp;amp;gt; true,<br \/>\n\t\t)<br \/>\n\t);<br \/>\n}<\/p>\n<p>[\/php]<\/p>\n<p>First we register the function <code>create_mobiles_type<\/code> with the <code>init<\/code> action of WordPress. Then in the function <code>create_mobiles_type<\/code> we use the function\u00a0<code>register_post_type<\/code> to register our mobiles type giving it the arguments to display its plural name as Mobiles and its singular name as Mobile. Then we also specified the arguments to make this custom type as public show it will show up in the WordPress admin and it has archives.<\/p>\n<p>Once we have added this code to our plugin and everything is right you should be able to see the mobiles menu in the left of your WordPress admin as seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87833\" title=\"3\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/31.png\" alt=\"\" width=\"600\" height=\"288\" \/><\/p>\n<p>Now we can start adding new mobiles by clicking on add new.<\/p>\n<h2>Adding support for thumbnails and custom fields<strong> <\/strong><\/h2>\n<p>When we register a custom post type by default it supports only title and the editor. So if we go to the Add New for mobiles we will only see the title and the editor. We can add many other things like excerpt, custom fields , thumbnails etc. which we want to add on our custom post type. To add these things on our custom post type we have <em>\u2018support\u2019<\/em> argument on the <code>register_post_type<\/code>.<\/p>\n<p>Now let\u2019s update our <code>register_post_type<\/code> call as below:<\/p>\n<p>[php]<br \/>\nregister_post_type( &#8216;Mobiles&#8217;,<br \/>\n\t\tarray(<br \/>\n\t\t\t&#8216;labels&#8217; =&amp;amp;amp;gt; array(<br \/>\n\t\t\t\t&#8216;name&#8217; =&amp;amp;amp;gt; __( &#8216;Mobiles&#8217; ),<br \/>\n\t\t\t\t&#8216;singular_name&#8217; =&amp;amp;amp;gt; __( &#8216;Mobile&#8217; )<br \/>\n\t\t\t),<br \/>\n\t\t&#8216;public&#8217; =&amp;amp;amp;gt; true,<br \/>\n\t\t&#8216;has_archive&#8217; =&amp;amp;amp;gt; true,<br \/>\n        &#8216;supports&#8217; =&amp;amp;amp;gt; array(<br \/>\n        &#8216;title&#8217;,<br \/>\n        &#8216;editor&#8217;,<br \/>\n        &#8216;author&#8217;,<br \/>\n        &#8216;excerpt&#8217;,<br \/>\n        &#8216;thumbnail&#8217;,<br \/>\n        &#8216;custom-fields&#8217;,<br \/>\n        &#8216;revisions&#8217;,)<br \/>\n\t\t)<br \/>\n\t);<br \/>\n[\/php]<\/p>\n<p>In the above call we add the support for excerpt, thumbnail, custom fields\u2019 etc. Now if you go to you Add New page you will be able to see the excerpt and custom fields below the editor and set feature image to the right as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87834\" title=\"4\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/2_4.png\" alt=\"\" width=\"600\" height=\"383\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87835\" title=\"5\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/2_5.png\" alt=\"\" width=\"600\" height=\"367\" \/><\/p>\n<p>Now you can add an entry for you mobile giving its title, description. You can add a feature image for your mobile and add custom fields to it like for example Price and provide the value for it.<\/p>\n<h2>Adding Categories \u00a0and post tag to custom post type<\/h2>\n<p>Once we have added the support for different functionality we can also add category and post tag support to your custom post type. This will be a great help if you want to assign different categories or post tag to you custom post type.<\/p>\n<p>To add categories and post tag to your custom post type you can either add the taxonomies argument to <code>register_post_type<\/code> as below:<\/p>\n<p>[php]<br \/>\nregister_post_type( &#8216;Mobiles&#8217;,<br \/>\n\t\tarray(<br \/>\n\t\t\t&#8216;labels&#8217; =&amp;amp;amp;gt; array(<br \/>\n\t\t\t\t&#8216;name&#8217; =&amp;amp;amp;gt; __( &#8216;Mobiles&#8217; ),<br \/>\n\t\t\t\t&#8216;singular_name&#8217; =&amp;amp;amp;gt; __( &#8216;Mobile&#8217; )<br \/>\n\t\t\t),<br \/>\n\t\t&#8216;public&#8217; =&amp;amp;amp;gt; true,<br \/>\n\t\t&#8216;has_archive&#8217; =&amp;amp;amp;gt; true,<br \/>\n        &#8216;supports&#8217; =&amp;amp;amp;gt; array(<br \/>\n        &#8216;title&#8217;,<br \/>\n        &#8216;editor&#8217;,<br \/>\n        &#8216;author&#8217;,<br \/>\n        &#8216;excerpt&#8217;,<br \/>\n        &#8216;thumbnail&#8217;,<br \/>\n        &#8216;custom-fields&#8217;,<br \/>\n        &#8216;revisions&#8217;,),<br \/>\n\t\t&#8216;taxonomies&#8217; =&amp;amp;amp;gt; array(&#8216;category&#8217;, &#8216;post_tag&#8217;)<br \/>\n\t\t)<br \/>\n\t);<br \/>\n[\/php]<\/p>\n<p>Or you can also use the function <code>register_taxonomy_for_object_type<\/code> to register different taxonomies to your post type. You can do that as follows in your <code>init<\/code> hook.<\/p>\n<p>[php]<br \/>\nregister_taxonomy_for_object_type(&#8216;category&#8217;, &#8216;Mobiles&#8217;);<\/p>\n<p>register_taxonomy_for_object_type(&#8216;post_tag&#8217;, &#8216;Mobiles&#8217;);<br \/>\n[\/php]<\/p>\n<p>Once you have done that you will see the categories and tags below your Mobiles menu:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87836\" title=\"6\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/6.png\" alt=\"\" width=\"600\" height=\"222\" \/><\/p>\n<p>And when you do an Add new for your mobiles you will see your categories and post tag which you can associate to your Mobiles as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87837\" title=\"7\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/7.png\" alt=\"\" width=\"600\" height=\"547\" \/><\/p>\n<h2>Showing Custom post types in the theme<\/h2>\n<p>Once we have created the custom post type and from the WordPress admin added the different Mobiles which we want to add its time now to show your custom post type on the from end.<\/p>\n<p>Now depending on the need of your site you might want to show your mobiles on the home page along with other blog posts. To do this you have to hook into the WordPress filter pre_get_posts which passes the query before actually executing the query.<\/p>\n<p>So to show the custom post type on the home page add the following code to your plugin:<\/p>\n<p>[php]<br \/>\nadd_filter( &#8216;pre_get_posts&#8217;, &#8216;add_mobiles&#8217; );<\/p>\n<p>function add_mobiles( $query ) {<\/p>\n<p>\tif ( is_home() &amp;amp;amp;amp;&amp;amp;amp;amp; $query-&amp;amp;amp;gt;is_main_query() )<br \/>\n\t\t$query-&amp;amp;amp;gt;set( &#8216;post_type&#8217;, array( &#8216;post&#8217;, &#8216;Mobiles&#8217;) );<\/p>\n<p>\treturn $query;<br \/>\n}<br \/>\n[\/php]<\/p>\n<p>In the above code we hook into the <code>pre_get_posts<\/code> filter and there we check if we are on the homepage and if this is the main query then we set the <code>post_type<\/code> on the query as post and also Mobiles. So now if we go and see the home page you should be able to see your mobile entries as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87838\" title=\"8\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/8.png\" alt=\"\" width=\"600\" height=\"318\" \/><\/p>\n<p>Also you might want to query for your Mobiles at any other place either in your theme files or some other place. In that case you can use <code>query_post<\/code> by set the <code>post_type<\/code> as Mobiles:<\/p>\n<p>[php]<br \/>\n$args = array(<br \/>\n\t&#8216;post_type&#8217;=&amp;amp;amp;gt; &#8216;Mobiles&#8217;,<\/p>\n<p>);<br \/>\nquery_posts( $args );<br \/>\n[\/php]<\/p>\n<p>If you are new to <code>query_posts<\/code> you can get more details about it on <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/query_posts\/\">Function Reference\/query posts<\/a>.<\/p>\n<h2>Customizing the singles page for custom post type<\/h2>\n<p>Once you have got to display the custom post type on you site you might want the singles page for the custom post type to be different than that for normal posts. WordPress allows in your theme to have a separate single page for each post type. To do that you have to define a single-&lt;post type&gt;.php, so for us we will define single-mobiles.php. As I am using the default TwentyEleven theme I will make a copy of the single.php and name it as single-mobiles.php. You can do the same irrespective of the theme you are using.<\/p>\n<p>Now in my single-mobiles.php I change the line:<\/p>\n<p>[php]&amp;lt;?php get_template_part( &#8216;content&#8217;, &#8216;single&#8217; ); ?&amp;gt;[\/php]<\/p>\n<p>to<\/p>\n<p>[php]&amp;lt;?php get_template_part( &#8216;content&#8217;, &#8216;mobiles&#8217; ); ?&amp;gt;[\/php]<\/p>\n<p>so that for mobiles type it starts fetching the content from the file content-mobiles rather than content-single.<\/p>\n<p>Now we will create a file content-mobiles.php which is a copy from content.single.php. Once I have made the copy I just want to make the changes to display the price of the mobile which we have added as a custom field as shown in the custom field screen shot above. To do that I just add the following code below the call to <code>the_content();<\/code>.<\/p>\n<p>[html]<br \/>\n&amp;lt;div class=&amp;quot;entry-content&amp;quot;&amp;gt;<br \/>\n\t&amp;lt;?php<br \/>\n\t\tthe_content();<br \/>\n\t\techo &amp;quot;Price: &amp;quot; . get_post_meta( get_the_ID(), &#8216;Price&#8217;, true);<br \/>\n\t?&amp;gt;<br \/>\n\t&amp;lt;?php<br \/>\n\t\twp_link_pages( array(<br \/>\n\t\t\t&#8216;before&#8217; =&amp;gt; &#8216;&amp;lt;div class=&amp;quot;page-link&amp;quot;&amp;gt;&amp;lt;span&amp;gt;&#8217; . __( &#8216;Pages:&#8217;, &#8216;twentyeleven&#8217; ) . &#8216;&amp;lt;\/span&amp;gt;&#8217;,<br \/>\n\t\t\t&#8216;after&#8217; =&amp;gt; &#8216;&amp;lt;\/div&amp;gt;&#8217;<br \/>\n\t\t) );<br \/>\n\t?&amp;gt;<br \/>\n&amp;lt;\/div&amp;gt;&amp;lt;!&#8211; .entry-content &#8211;&amp;gt;<br \/>\n[\/html]<\/p>\n<p>In the above code you get the post meta using the WordPress function get_post_meta. This function retrieves the meta value for a particular post id. For more details on <code>get_post_meta<\/code> you can visit <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_post_meta\/\">Function Reference\/get post meta<\/a>.<\/p>\n<p>Once you have added the above code and go to the permalink of your mobile entry you will start seeing the price there below the content as seen below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-87839\" title=\"9\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/9.png\" alt=\"\" width=\"600\" height=\"265\" \/><\/p>\n<h3>Conclusion<\/h3>\n<p>WordPress as a framework has become very flexible and allows it to be customized in a variety of ways to be used for sites of varied functionalities and purposes. WordPress with custom post types allows one to add different types of content to ones site which are other than just posts and pages. You can have easily one or more custom post types which directly help to map and organize the content which you want to store and display on your site. WordPress also provides the flexibility and infrastructure to display different custom types at different places on your site and also lets you style them differently. So take full advantage of custom post types in the next WordPress site you build.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress started as a blogging engine to create blogs. As WordPress has gone more and more popular because of its ease of use, flexibility and beautiful user interface there was a need to make WordPress a platform for a wide variety of sites. WordPress as a platform now has great features which can be extended [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":87851,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-87824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Custom Post Types in WordPress - WordPress Guides<\/title>\n<meta name=\"description\" content=\"In this article, we are going to see how we can use the custom post type feature to create additional custom types to extend the functionality of WordPress.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom Post Types in WordPress - WordPress Guides\" \/>\n<meta property=\"og:description\" content=\"In this article, we are going to see how we can use the custom post type feature to create additional custom types to extend the functionality of WordPress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/\" \/>\n<meta property=\"og:site_name\" content=\"WordPress Guides\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-18T10:51:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-11T10:01:03+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3\"},\"headline\":\"Custom Post Types in WordPress\",\"datePublished\":\"2012-10-18T10:51:25+00:00\",\"dateModified\":\"2025-11-11T10:01:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/\"},\"wordCount\":1738,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/\",\"url\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/\",\"name\":\"Custom Post Types in WordPress - WordPress Guides\",\"isPartOf\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2012-10-18T10:51:25+00:00\",\"dateModified\":\"2025-11-11T10:01:03+00:00\",\"description\":\"In this article, we are going to see how we can use the custom post type feature to create additional custom types to extend the functionality of WordPress.\",\"breadcrumb\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/strictthemes.com\/articles\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Custom Post Types in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#website\",\"url\":\"https:\/\/strictthemes.com\/articles\/\",\"name\":\"WordPress Guides\",\"description\":\"Create WordPress websites for begginers.\",\"publisher\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/strictthemes.com\/articles\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\",\"name\":\"WordPress Guides\",\"url\":\"https:\/\/strictthemes.com\/articles\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png\",\"contentUrl\":\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png\",\"width\":500,\"height\":500,\"caption\":\"WordPress Guides\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/strictthemes.com\/articles\"],\"url\":\"https:\/\/strictthemes.com\/articles\/author\/andrian\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom Post Types in WordPress - WordPress Guides","description":"In this article, we are going to see how we can use the custom post type feature to create additional custom types to extend the functionality of WordPress.","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:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/","og_locale":"en_US","og_type":"article","og_title":"Custom Post Types in WordPress - WordPress Guides","og_description":"In this article, we are going to see how we can use the custom post type feature to create additional custom types to extend the functionality of WordPress.","og_url":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/","og_site_name":"WordPress Guides","article_published_time":"2012-10-18T10:51:25+00:00","article_modified_time":"2025-11-11T10:01:03+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#article","isPartOf":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/"},"author":{"name":"admin","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3"},"headline":"Custom Post Types in WordPress","datePublished":"2012-10-18T10:51:25+00:00","dateModified":"2025-11-11T10:01:03+00:00","mainEntityOfPage":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/"},"wordCount":1738,"commentCount":4,"publisher":{"@id":"https:\/\/strictthemes.com\/articles\/#organization"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage"},"thumbnailUrl":"","articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/","url":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/","name":"Custom Post Types in WordPress - WordPress Guides","isPartOf":{"@id":"https:\/\/strictthemes.com\/articles\/#website"},"primaryImageOfPage":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage"},"thumbnailUrl":"","datePublished":"2012-10-18T10:51:25+00:00","dateModified":"2025-11-11T10:01:03+00:00","description":"In this article, we are going to see how we can use the custom post type feature to create additional custom types to extend the functionality of WordPress.","breadcrumb":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/strictthemes.com\/articles\/wordpress-custom-post-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/strictthemes.com\/articles\/"},{"@type":"ListItem","position":2,"name":"Custom Post Types in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/strictthemes.com\/articles\/#website","url":"https:\/\/strictthemes.com\/articles\/","name":"WordPress Guides","description":"Create WordPress websites for begginers.","publisher":{"@id":"https:\/\/strictthemes.com\/articles\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/strictthemes.com\/articles\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/strictthemes.com\/articles\/#organization","name":"WordPress Guides","url":"https:\/\/strictthemes.com\/articles\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/","url":"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png","contentUrl":"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png","width":500,"height":500,"caption":"WordPress Guides"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/strictthemes.com\/articles"],"url":"https:\/\/strictthemes.com\/articles\/author\/andrian\/"}]}},"_links":{"self":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/87824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/comments?post=87824"}],"version-history":[{"count":3,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/87824\/revisions"}],"predecessor-version":[{"id":690198,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/87824\/revisions\/690198"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/media?parent=87824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/categories?post=87824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/tags?post=87824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}