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 admin area.
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’s functions.php file or in a site-specific plugin.
We have included some code snippets in this post. The snippet titled “Register a basic Custom Post Type” registers a post type with an array of arguments. These arguments are the options of our custom post type.
This array has contains basic information about the Custom Post Type, such as the name and singular name and also contains other arguments like public visibility, has archive, slug, and show_in_rest enables block editor support.
Register a basic Custom Post Type
// Register our Team post type add_action( ‘init’, ‘create_custom_post_type’, 0 ); function create_custom_post_type() { // Set UI labels for custom post type array( ‘name’ => _x( ‘CPT Name’, ‘Post Type …
Read moreRegister a Custom Post Type in detail
// Register our Team post type add_action( ‘init’, ‘create_custom_post_type’, 0 ); function create_custom_post_type() { // Set UI labels for custom post type $labels = array( ‘name’ => _x( ‘CPT’, ‘Post …
Read more