How To Add Custom Post Type In WordPress Without Using Plugin?

wordpress-image-in-image-tag.png

Below I have shown the simple way to add custom post type in our WordPress site.

Just open your functions.php file. and at the end of your file copy and paste below code to add your own custom post type.

add_action( 'init', 'create_post_type' );
function create_post_type() {
  register_post_type( 'events',  // always in lower case
    array(
      'labels' => array(
        'name' => __( 'Events' ),         //the name of our post type, you can add any you want. 
        'singular_name' => __( 'Event' )
      ),
      'public' => true,
      'has_archive' => true,
    )
  );
}

We are accepting blogs for Tech News Write For Us category.