Skip to content Skip to main navigation Skip to footer

Add Custom META Title

With the Squirrly SEO plugin, you can customize the META Title for each URL on your website using the:

  • Squirrly SEO Snippet,
  • Squirrly SEO > Automation > Configuration
  • or by calling the sq_title hook in your code.

To edit the META Title using the SEO Automation, follow the instructions from detailed here >

To edit the META Title using the sq_title hook, activate Squirrly SEO plugin and add this code in function.php file:

//Hook the Squirrly sq_title 
add_filter('sq_title', 'custom_squirrly_title', 11);
function custom_squirrly_title($title) {
    return 'My custom META Title';
}

The code above will show the same title for all the pages on your website.

To get the default WordPress page title, you can use return get_the_title();

If you want to change the title only for some post IDs you can add the hook like:

//Hook the Squirrly sq_title
add_filter('sq_title', 'custom_squirrly_title', 11);
function custom_squirrly_title($title) {
    global $post;
    switch ($post->ID) {
        case 1:
            $title = 'My Title For Post ID 1';  //for post_id = 1
        case 2:
            $title = 'My Title For Post ID 2';   //for post_id = 2
    }
    //return the title
    return $title;
}

How to customize the META Title using the BULK SEO feature from Squirrly >

Was This Article Helpful?