admin管理员组文章数量:1326123
I have a custom post type created in my theme, the post type is called "Portfolio". I would like to entirely duplicate this custom post type and give it the name "Projects" so it would display in the admin menu as a new post type.
Is it possible to duplicate a post type with its post meta boxes? Hope this makes sense. Thanks
I have a custom post type created in my theme, the post type is called "Portfolio". I would like to entirely duplicate this custom post type and give it the name "Projects" so it would display in the admin menu as a new post type.
Is it possible to duplicate a post type with its post meta boxes? Hope this makes sense. Thanks
Share Improve this question asked Aug 13, 2020 at 0:15 KenshinhKenshinh 351 silver badge4 bronze badges1 Answer
Reset to default 0This is definitely possible. I'm going to assume that you're using a theme that you didn't write yourself, so best practice will be to create a child theme with your current theme as the parent (called 'template' in the thild theme).
Next, you'll want to find the custom post type and its meta boxes in the parent theme. The first file you'll want to check is functions.php
. This tutorial on Custom Post Types from WP Beginner will help you identify the CPT you want to copy.
Copy the CPT from the parent theme's file to the child theme's file, then update all the fields so that they're different from the parent's CPT.
You'll also need to find the metaboxes that have been created for the CPT as well. Here's a quick tutorial from SitePoint on what custom meta boxes in CPTs look like. Hopefully those are in the functions file, but if not, you'll need to root around and find them, which can be messy, but is doable.
Once it's set up correctly you'll need to update your theme in the WP Appearance menu. If everything goes according to plan, your new CPT will show up on the menu to the left. Good luck!
本文标签: How to duplicate entire custom post type
版权声明:本文标题:How to duplicate entire custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742191371a2430276.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论