Make custom post type a media library

enter image description here

So I have the below code on attempting to create a media library custom post type but I’m not getting the media library and it’s just a regular post type.

Here is the method inside my class:

public static function doc_post_type() {
    add_action('init', function() {
        $labels = array(
            'name' => _x('Doc', 'post type general name'),
            'singular_name' => _x('Doc', 'post type singular name'),
            'menu_name' => 'Docs',
            'add_new' => _x('Add New', 'doc item'),
            'parent_item_colon' => ''

        register_post_type('doc_post_type' , array(
            'labels' => $labels,
            'public' => true,
            'has_archive' => false,
            'rewrite' => false,
            'supports' => array('title', 'editor')
    register_taxonomy_for_object_type('media_category', 'doc_post_type');

Here is the custom post type in action:

Read more here:: Make custom post type a media library

Leave a Reply

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