Taha
Taha

Reputation: 1

How to remove character "-" from Wordpress website name

As shown in the first picture below, my website's name shows a "-" in the Google search results.

Google Search Result

I tried editing it on my website in the Site Identity section but the "-" is not visible in the Site Title.

Site Title

Need help in understanding where should I make the changes on the website to remove the "-".

Upvotes: 0

Views: 350

Answers (1)

Cody MacPixelface
Cody MacPixelface

Reputation: 1386

The Olsen Light theme utilizes the add_theme_support( 'title-tag' ); function, which is recommended for handling page/post titles. It uses the "-" separator by default.

You can try to filter this with the document_title_separator hook to change the separator.

From the back of my head, and not tested, you can add this to the functions.php file in your theme folder:

function taha_set_document_title_separator ($sep) {
    if (empty(get_bloginfo('description'))) {
        return ('') ;
    } else {
        return ('-') ;
    }
}

add_filter ('document_title_separator', 'taha_set_document_title_separator') ;

What I'm trying to do is to check if your blog description is empty. If it is, then the separator symbol is just an empty space. If you have a description, then the separator would be the "-" as per default.

Hope this helps!

Upvotes: 1

Related Questions