Add Custom META Title

With Squirrly SEO plugin you can customize the META Title for each URL on your website using the Squirrly SEO Snippet, Squirrly > SEO Settings > Automation or by calling the sq_title hook in your code.

To edit the META Tile using the SEO Automation follow the instructions from this URL:
https://howto.squirrly.co/kb/seo-automation/

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 above code 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 Squirrly SEO plugin:
https://howto.squirrly.co/kb/bulk-seo/#bulk_seo_snippet_metas

Was This Article Helpful?

0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *