Registered post type – WP register custom post type function

please click here for more wordpress cource

If want to need other post type Instead of blog post type or default WordPress post type. Then you can use this function and register other new post type as you need in this example. I tall you about custom post type in details and give some lines of code with example

Custom post type details:

I can register a custom post type with the register_post_type function. This should not be hooked before init. So, the good option is to call it with an init hook.

Post types can support any number of built-in core features such as meta boxes, custom fields, post thumbnails, post statuses, comments, and more. See the $supports the argument for a complete list of supported features.

function wpaccuracy_create_post_type() {

/*in this example i can register custom post type name is "Products"*/
  register_post_type( 'acme_product',
    array(
      'labels' => array(
        'name' => __( 'Products' ),
        'singular_name' => __( 'Product' )
      ),
      'public' => true,
      'has_archive' => true,
    )
  );
}
add_action( 'init', 'wpaccuracy_create_post_type' );

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *