WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] Title tag is messed about even if there aren't any settings in (10 posts)

  1. dashaluna
    Member
    Posted 2 years ago #

    Hello,

    I've got my own code to construct the title tag, which is using wp_title function.

    After installing the SEO plugin, I haven't specified any settings in the SEO->Titles section, it's completely empty. Nevertheless, the plugin keeps inserting (I'm guessing) some default settings into the title and it became total gibberish.

    Is it possible to turn off that feature some how?

    Many thanks,
    Dasha

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. SuperFastCars
    Member
    Posted 2 years ago #

    You need to go to this file;
    wp-content/themes/(your theme folder)/header.php

    Find this;
    <title><?php (a bunch of random code) ?></title>

    To this;

    <title><?php
    	if(is_home() || is_front_page()) {
    		echo bloginfo("name") . " | " . bloginfo("description");
    	} else {
    		echo wp_title('', true, 'right');
    	}
    	?></title>

    Once you do that, you will need to force a refresh, you can clear your browser cache. Or you can press ctrl + F5 in most browsers to force a refresh. He had to change wp_title() code to make title changes possible with this plugin.

  3. dashaluna
    Member
    Posted 2 years ago #

    @SuperFastCars thanks for the reply. I do have my own code in the header:

    <title>
    		<?php //print the <title> tag based on what is being viewed
    			global $page, $paged;
    
    			wp_title('|', true, 'right');
    
    //add a page number if necessary
    			if(($paged >= 2 || $page >= 2) && !is_single()){
    				echo sprintf('Page %s', max($paged, $page)) . ' | ';
    			}
    
    			//add the site's name
    			bloginfo('name', 'display');
    		?>
    	</title>

    So when plugin is inactive, I've got nicely looking titles constructed from my code, for example: Category Name | Page num | Blog name.

    When I activate a plugin, but don't have any settings for the Titles at all.. it messes with wp_title output with its own default setup, so now my title becomes: Category Name | Page num/Page total | Blog name Page num | Blog name. Where the last Page num | Blog name is coming from my code.

    I just want to tweak it so that if there aren't any settings in the Titles section of the SEO plygin, it won't insert it's own default titles.

    Does that make sense?

    Thanks.

  4. SuperFastCars
    Member
    Posted 2 years ago #

    I read what you said. And you have a few options;
    1. Deactivate /SEO by Yoast/. No more title code altered. There is no way to prevent it from changing your titles in the settings.
    2. Using the code I gave you. (Which your saying is not the same style you want.)
    3. Writing your own code.
    4. Trying to use the SEO panel below your pages/posts where you can edit manually every title on your page. After using #2.
    5. Use the force template options and the formatting shown in the SEO settings to change the layout. After using #2.
    6. Trying to get the developer for /SEO by Yoast/ write a more graceful implementation of title modification features.

    I totally get what your saying. And I think #6, will get you to;
    -Option to disable site title alterations. (not coded)
    -Option to change the way titles are driven. (partially coded by #5)

    I am a coder, but at this time I'm refraining from writing any plugins. So yeah, sorry if it's not giving you the titles exactly the way you want.

  5. dashaluna
    Member
    Posted 2 years ago #

    Ok, I figured out how to remove wp_title filter that WordPress SEO adds. Add this code to the functions.php:

    global $wpseo_front;
    if(isset($wpseo_front)){
    	remove_filter('wp_title', array($wpseo_front, 'title'));
    }

    Hope that helps someone too.

  6. clutchnyc
    Member
    Posted 1 year ago #

    Thank you Dashaluna! This really helped me a lot - exactly what I was looking for!

  7. Joost de Valk
    Member
    Plugin Author

    Posted 1 year ago #

    Still though: why? :)

  8. Sheharyar
    Member
    Posted 1 year ago #

    Try this, worked for me:

    1. Open wp-content/themes/[your-theme]/header.php in a text-editor
    2. Find this:
    <title><?php *bunch of code* ?></title>
    and replace it with
    <title><?php wp_title(''); ?></title>
    3. Save it.

    and you're done!

  9. lister110
    Member
    Posted 1 year ago #

    Hey, sorry to hijack this post, but I have a similar problem. I am using the theme storefront elegance and have installed the SEO Yoast which generates the title tag on each page, but the theme does the same thing (in the source code). How do I hide the SEO title tag in the source? I have added your code dashaluna in the functions of the theme, flushed the cache but it still displays.. any ideas??

    http://www.intovintage.co.uk

    Thanks

  10. lister110
    Member
    Posted 1 year ago #

    Why is this thread now resolved?, I have added the code to the function and the SEO title still displays

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic