register_post_type( string $post_type, array|string $args = array() )
Example: add in function.php file
function create_posttype() {
register_post_type( 'movies',
// CPT Options
array(
'labels' => array(
'name' => __( 'Movies' ), // plural and first latter capital
'singular_name' => __( 'Movie' )
),
'public' => true,
'has_archive' => true, // display inarchiv page
'rewrite' => array('slug' => 'movies'), // use for url name www.example.com/movies/
)
);
}Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
>> init for insert data using _GET or _POST method >> Here movies slug of post type , labels is display name in dashboard menu