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!