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:

enter image description here


While a Media Item is stored as a semi-regular "post-type" named attachment, the edit page and the scripts that get called when you want to edit or upload an attachment are completely different. You won't be able to recreate the media library without some SERIOUS programming efforts.

  • Thanks a bunch @HU ist Sebastian, I didn't know if it's a 'template' that you can work with. – SLE Feb 5 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.