Skip to content

Meta Title Tag

You don’t need to configure meta title tag. WordPress already has this featured! All we need to do is add theme support for title-tag.

add_theme_support( 'title-tag' );

We already do that hundreds times while coding themes. And WordPress does its job pretty well.

So, with Slim SEO, this feature is automatically enabled.

The title tag will have the following format:

  • For homepage: Site title – Site description
  • For singular pages/posts: Page/Post title – Site title
  • For other pages: Page title – Site title

How to change meta title manually?

If you want to set custom meta title for a specific post or term, simply enter the text in the Search Engine Optimization meta box below the content area:

Search Engine Optimization meta box

You’ll see the status icon showing if the description has a good length. The meta title should not be longer than 60 characters.

Note that, the manual meta title is not truncated. It’s always shown as it is.

How to change the meta title with code?

If you want to change the title, please use the slim_seo_meta_title filter.

The following code changes the meta title for a single post with ID = 24. The title is get via a custom field:

add_filter( 'slim_seo_meta_title', function( $title ) {
    if ( is_single( 24 ) ) {
        $title = get_post_meta( get_the_ID(), 'field_id', true );
    }
    return $title;
} );