# Make a Plugin's Post Type Admin-Only

> Removes the public pages, archive and search presence of a post type registered by a plugin or theme while keeping it editable in the admin.

- Type: PHP
- Runs: Run everywhere
- Category: [Custom Post Types & Fields](https://wpide.com/library/category/post-types/)
- Tags: custom-post-types, visibility, seo
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/hide-post-type-front-end/

## Code

```php
// Post types to hide from visitors.
$wpide_private_types = array( 'portfolio' );

add_filter( 'register_post_type_args', function ( $args, $post_type ) use ( $wpide_private_types ) {
    if ( in_array( $post_type, $wpide_private_types, true ) ) {
        $args['public']              = false;
        $args['publicly_queryable']  = false;
        $args['exclude_from_search'] = true;
        $args['show_in_nav_menus']   = false;
        $args['has_archive']         = false;
        $args['rewrite']             = false;
        $args['show_ui']             = true;
    }

    return $args;
}, 10, 2 );
```

## Notes

Use for internal records that should never be public, then visit Settings > Permalinks once.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Make a Plugin's Post Type Admin-Only" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
