{"id":825,"date":"2018-12-31T18:55:25","date_gmt":"2018-12-31T13:25:25","guid":{"rendered":"http:\/\/blog.openwebsolutions.in\/?p=825"},"modified":"2019-01-01T11:35:42","modified_gmt":"2019-01-01T06:05:42","slug":"create-custom-post-type-manually-wordpress","status":"publish","type":"post","link":"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-wordpress\/","title":{"rendered":"How to create custom post type manually in WordPress?"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>In this blog, we are going to show how to create custom post type manually in WordPress. Custom post type is like a page or you can say a component just like posts, pages, etc. Before we proceed, we need to have our functions.php of our main theme. If we use child theme then we should open functions.php in any code editor.<\/p>\n<p>In the file\u00a0<strong>functions.php<\/strong>, write the following code to create a custom post type. Let us assume that we have to create custom post type named as Testimonial.<\/p>\n<p>&nbsp;<\/p>\n<h4><em>The code<\/em><\/h4>\n<pre>\/*\u00a0 custom post type function name *\/<\/pre>\n<pre>function custom_post_type_function_name() {\r\n    register_post_type('testimonial',\r\n        \/\/options\r\n        array(\r\n            'labels' =&gt; array(\r\n                 'name' =&gt; __('Testimonials'),\r\n                 'singular_name' =&gt; __(Testimonial)\r\n            ),\r\n            'public' =&gt; true,\r\n            'has_archive' =&gt; true,\r\n            'rewrite' =&gt; array('slug' =&gt; 'testimonial'),\r\n            \/\/if we need custom icon\r\n            'menu_icon' =&gt; 'dashicons-format-chat',\r\n        )\r\n    );\r\n}\r\n\r\n\/\/invoke the function\r\nadd_action('init', 'custom_post_type_function_name');\r\n\r\n\r\n<\/pre>\n<p>This is the basic method to create a new custom post manually. There are lots of options by which we can control our custom post type. We will discuss those options later on.<\/p>\n<p>Please share if you like it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; In this blog, we are going to show how to create custom post type manually in WordPress. Custom post type is like a page or you can say a component just like posts, pages, etc. Before we proceed, we need to have our functions.php of our main theme. If we use child theme then [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":836,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,18,5],"tags":[33,43],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to create custom post type manually in WordPress?<\/title>\n<meta name=\"description\" content=\"In this blog, we are going to show how to create custom post type manually in Wordpress. Custom post type is like a page or you can say a component\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-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 type manually in WordPress?\" \/>\n<meta property=\"og:description\" content=\"In this blog, we are going to show how to create custom post type manually in Wordpress. Custom post type is like a page or you can say a component\" \/>\n<meta property=\"og:url\" content=\"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Openweb Solutions Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-31T13:25:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-01-01T06:05:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2018\/12\/cpt-bg-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/\",\"name\":\"Openweb Solutions Blog\",\"description\":\"Transforming ideas into reality\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/openwebsolutions.in\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-wordpress\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/wp-content\/uploads\/2018\/12\/cpt-bg-1.jpg\",\"width\":1024,\"height\":500},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-wordpress\/#webpage\",\"url\":\"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-wordpress\/\",\"name\":\"How to create custom post type manually in WordPress?\",\"isPartOf\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-wordpress\/#primaryimage\"},\"datePublished\":\"2018-12-31T13:25:25+00:00\",\"dateModified\":\"2019-01-01T06:05:42+00:00\",\"author\":{\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/615090f954d8460cf6186cf920b47398\"},\"description\":\"In this blog, we are going to show how to create custom post type manually in Wordpress. Custom post type is like a page or you can say a component\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/openwebsolutions.in\/blog\/create-custom-post-type-manually-wordpress\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#\/schema\/person\/615090f954d8460cf6186cf920b47398\",\"name\":\"Preetam Mallick\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/openwebsolutions.in\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ed836329485e177373e4ff5323b6670a?s=96&r=g\",\"caption\":\"Preetam Mallick\"},\"description\":\"Frontend developer at Openweb Solutions\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/825"}],"collection":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/comments?post=825"}],"version-history":[{"count":7,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/825\/revisions"}],"predecessor-version":[{"id":858,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/posts\/825\/revisions\/858"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media\/836"}],"wp:attachment":[{"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/media?parent=825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/categories?post=825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openwebsolutions.in\/blog\/wp-json\/wp\/v2\/tags?post=825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}