# Remove the Site Name From Post Titles

> Shows only the post or page name in the browser tab and search results on single posts and pages, leaving more room for a descriptive title.

- Type: PHP
- Runs: Run everywhere
- Category: [SEO](https://wpide.com/library/category/seo/)
- Tags: title, posts, search-results
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/remove-site-name-from-post-titles/

## Code

```php
// Post types without the site name in the title (empty array = all).
$wpide_title_post_types = array();

add_filter( 'document_title_parts', function ( $parts ) use ( $wpide_title_post_types ) {
    if ( ! is_singular() || is_front_page() ) {
        return $parts;
    }

    if ( $wpide_title_post_types && ! is_singular( $wpide_title_post_types ) ) {
        return $parts;
    }

    unset( $parts['site'], $parts['tagline'] );

    return $parts;
} );
```

## Notes

Set $wpide_title_post_types to limit it to certain post types.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Remove the Site Name From Post Titles" 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/
