I am just wondering is it possible to create a custom post type in wordpress which is hidden from the wordpress admin panel?


If you want it to be visible everywhere (i.e. search), just without the admin menu, then something to the effect of the following should do the trick when added to functions.php in the theme directory:

register_post_type( 'project',
        'labels' => array(
        'name' => _x( 'Projects', 'post type general name', 'namespace' ),
        'singular_name' => _x( 'Project', 'post type singular name', 'namespace' ),
        'add_new' => __( 'Add a New Project', 'namespace' ),
        'add_new_item' => __( 'Add a New Project', 'namespace' ),
        'edit_item' => __( 'Edit Project', 'namespace' ),
        'new_item' => __( 'New Project', 'namespace' ),
        'view_item' => __( 'View Project', 'namespace' ),
        'search_items' => __( 'Search Projects', 'namespace' ),
        'not_found' => __( 'Nothing Found', 'namespace' ),
        'not_found_in_trash' => __( 'Nothing found in Trash', 'namespace' ),
        'parent_item_colon' => ''
    'description' => "Projects",
    'public' => true, // All the relevant settings below inherit from this setting
    'exclude_from_search' => false, // When a search is conducted through search.php, should it be excluded?
    'publicly_queryable' => true, // When a parse_request() search is conducted, should it be included?
    'show_ui' => false, // Should the primary admin menu be displayed?
    'show_in_nav_menus' => false, // Should it show up in Appearance > Menus?
    'show_in_menu' => false, // This inherits from show_ui, and determines *where* it should be displayed in the admin
    'show_in_admin_bar' => false, // Should it show up in the toolbar when a user is logged in?
    'has_archive' => 'projects',
    'rewrite' => array( 'slug' => 'project' ),

The Wordpress Codex about register_post_type contains more comprehensive information: http://codex.wordpress.org/Function_Reference/register_post_type


Yes, it is possible to register a non-public custom post type

  • As majorano84 says. Use public => false as argument when registering the custom post type. – barakadam Dec 6 '12 at 15:08

Your Answer

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