Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Remove Site Title From Page Titles, Keep Site Info In Settings WordPress

  • SOLVED

Hi,

I would like to prevent the site title to show up in my page titles.
Currently I use this code for the page title:

<title><?php wp_title(''); ?></title>

As you can see there is no <?php bloginfo('name'); ?> reference, but because in the General Settings there is a field "Site Title" that is filled out WordPress automatically places this information in the page title.

How can I prevent this?

The easy answer would be to remove the "Site Title" information, but this needs to stay.

Thanks!

Answers (6)

2011-02-28

S├ębastien | French WordpressDesigner answers:

where wp_title('') displays the "Site Title" ? In your homepage ? In other page ?

wp_title display the title of the page if it's a page, the title of the category if it's a category etc...
wp_title don't display the "site title"

delete wp_title('') in your header.php and look at the resulat.
If the site title is yet display, the probleme is not wp_title and you have probably a bloginfo('name') somewhere


Edwin comments:

Hi Sebastian,

I understand wp-title doesn't display the site name in the page title.

The thing is that WordPress automatically adds the Site Title info you have set under General --> Settings to any page title site wide.

Normally I just delete it from General --> Settings to get page titles without the Site Tittle.

However I would like to keep this information under General --> Settings, but I do not want it to show up in my page titles site wide.


S├ębastien | French WordpressDesigner comments:

delete wp_title('') in your header.php and look at the resulat.
If the site title is yet display, the probleme is not wp_title and you have probably a bloginfo('name') somewhere
or a seo plugin (?)

2011-02-28

Nilesh shiragave answers:

what is your website url? are you using any seo plugin because i think maybe plugin changing your wordpress blog's <title> tag.


Edwin comments:

Hi Nilesh,

It's not because of a plugin, WordPress adds the Site Title value if present under General --> Settings on it's own, by default.

2011-02-28

Peter Harrison answers:

Hi

wp_title('') just displays the page title and not your site title. My guess is that you have a plugin adding the site title in, if there is nothing else in the title tags.

Have you got any SEO plugins installed?

Cheers
Pete


Edwin comments:

Hi Peter, see my answer to Nilesh.


Peter Harrison comments:

Hi,

If its not a plugin then it will be a filter as Ben as pointed out above. Check your functions.php for the word 'wp_title' to see if it has any filters applied to it and comment out as necessary.

Pete


Peter Harrison comments:

Hi,

I believe you are getting a little confused. WordPress never just includes the site title by itself. If you want what is in the General --> Settings section of your dashboard to show then your theme must contain either a function or filter to display it.

If you delete this setting and your site title no longer shows its because nothing is being passed to the filter or function.

In there is nothing else between the title tags in your header.php file then the site title will be getting added by either a plugin or filter.

As a quick test I would disable all plugins and see if the site title is still being displayed.

Pete


Peter Harrison comments:

Hi,

Just looking at that plugin from Yoast, [[LINK href="http://yoast.com/wordpress/seo/#title-description"]]this[[/LINK]] is the section that will be added the site title.

try disabling this plugin and see if its still adds your site title.

Pete

2011-02-28

Ben Huson answers:

...also check your theme's functions.php file as this may be overriding it.
For example:

add_filter( 'wp_title', 'twentyten_filter_wp_title', 10, 2 );

In this scenario the twentyten_filter_wp_title() function is filtering the title and automatically adding the blog name to it. If this is the case you should be able to comment out those bits of the twentyten_filter_wp_title() function


Edwin comments:

Hi Ben, I don't have a filter like that in place.
In fact I think I may need a filter like that, but one that will remove the default Site Title inclusion functionality by WordPress.

I am using a SEO Plugin from Joost de Valk at [[LINK href="http://www.yoast.com"]]Yoast.com[[/LINK]] , but that plugin doesn't offer the functionality to remove it or is responsible for the site title inclusion.

2011-02-28

Vidyut Kale answers:

Take the quotes out -
wp_title();

But actually, that wouldn't make any difference.

Try doing a quick search for the word 'title' in your theme functions file.... see if you find anything interesting.

Basically you are looking for a filter hooking on to wp_title() If not in the functions file, then search for any other plugin that may be interested in the title - SEO plugins, etc


Edwin comments:

Hi Vidyut,

It's not something any theme is responsible for, it's what WordPress adds by default via a function in the core files.

The solution would be to override this functionality via functions.php via some sort of filter.


Vidyut Kale comments:

Edwin,

Can you give some reference of this behaviour you describe with the title? I have never had a blog with the settings - blog title empty and I have never had a title appear unless I pulled

<?php bloginfo('name'); ?>


At least not that I remember. If you can point me to the page where this behaviour of wordpress is explained, it will help me learn something new, and possibly help find the solution for this as well.

2011-02-28

WPMan answers:

Try

<?php is_page() ? single_post_title(); : wp_title(); ?>


Edwin comments:

Hi WPMan,

That code produces this error:

Parse error: syntax error, unexpected ';'


WPMan comments:


<?php

if ( is_page() ) :
single_post_title();

else :
wp_title();

endif; ?>



I didn't test it. But hope this will work.

Basically apply if then else condition.