# Disable Posts for a Pages-Only Site

> Hides the built-in Posts type everywhere in the admin and on the front end, for brochure sites that only use pages.

- Type: PHP
- Runs: Run everywhere
- Category: [Disable Features](https://wpide.com/library/category/disable-features/)
- Tags: disable, posts, brochure
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/disable-posts-pages-only/

## Code

```php
add_filter( 'register_post_type_args', function ( $args, $post_type ) {
    if ( 'post' !== $post_type ) {
        return $args;
    }

    return array_merge( $args, array(
        'public'              => false,
        'publicly_queryable'  => false,
        'exclude_from_search' => true,
        'show_ui'             => false,
        'show_in_menu'        => false,
        'show_in_admin_bar'   => false,
        'show_in_nav_menus'   => false,
    ) );
}, 10, 2 );

add_action( 'wp_dashboard_setup', function () {
    remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
}, 99 );

add_action( 'admin_bar_menu', function ( $wp_admin_bar ) {
    $wp_admin_bar->remove_node( 'new-post' );
}, 999 );
```

## Notes

Existing posts return 404, so set a static homepage in Settings > Reading first.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Disable Posts for a Pages-Only Site" 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/
