• Resolved dashaluna

    (@dashaluna)


    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

    https://www.ads-software.com/extend/plugins/wordpress-seo/

Viewing 9 replies - 1 through 9 (of 9 total)
  • SuperFastCars

    (@superfastcars)

    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.

    Thread Starter dashaluna

    (@dashaluna)

    @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.

    SuperFastCars

    (@superfastcars)

    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.

    Thread Starter dashaluna

    (@dashaluna)

    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.

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

    Plugin Contributor joostdevalk

    (@joostdevalk)

    Still though: why? ??

    Sye

    (@psychosherry)

    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!

    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??

    https://www.intovintage.co.uk

    Thanks

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: WordPress SEO by Yoast] Title tag is messed about even if there aren't any settings in’ is closed to new replies.