Post types
This documentation for the Custom post types plugin for WordPress allows you to customize all features.
To get professional support you need to make a donation to get the PRO version of the plugin.
You can add as many post types as you like, as for the native WordPress public post types (posts and pages), if they are registered as public they will be present in the administrative menus and will be reachable from the frontend (single post type page).
New post type using UI
Registering and adding a new post type to your WordPress website has never been easier directly from the administration area.
- From the “Extend / Manage” menu click on the “Post types” item;
- From the “Post types” page at the top click on the “Add post type” button;
- Configure the new post type and click on the “Publish” button;
- The item relating to the post type created “Products” will be added to the main menu;
- Create and publish a “Product” as a blog post;
- See the new “Product” in the frontend;
cpt_post_types_register
apply_filters( 'cpt_post_types_register', $registered_post_types )
Filter the registered post types data.
- $registered_post_typesarray
Array of registered post types.
Example:
add_filter('cpt_post_types_register', function($post_types){
$post_types[] = [
'id' => 'products',
'singular' => 'Product',
'plural' => 'Products',
'args' => [], // Array or string of arguments for registering a post type.
'labels' => [] // An array of labels for this post type.
];
// See https://developer.wordpress.org/reference/functions/register_post_type/
return $post_types;
});
cpt_post_types_register_labels
apply_filters( 'cpt_post_types_register_labels', $registration_labels, $id )
Filter the registered post types labels.
- $registration_labelsarray
Array of post type labels.
- $idstring
Post type registration id.
Example:
add_filter('cpt_post_types_register_labels', function($registration_labels, $id){
if('products' == $id){
$registration_labels['edit_item'] = 'Customize product';
// See https://developer.wordpress.org/reference/functions/get_post_type_labels/
}
return $registration_labels;
}, 10, 2);
cpt_post_types_register_args
apply_filters( 'cpt_post_types_register_args', $registration_args, $id )
Filter the registered post types args.
- $registration_argsarray
Array of post type args.
- $idstring
Post type registration id.
Example:
add_filter('cpt_post_types_register_args', function($registration_args, $id){
if('products' == $id){
$registration_args['hierarchical'] = true;
// See https://developer.wordpress.org/reference/functions/register_post_type/
}
return $registration_args;
});