WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
add_filter( 'wpseo_title', '__return_false' ); - doesn't work (1 post)

  1. WPContent.com
    Member
    Posted 1 year ago #

    WordPress version: 3.5
    WordPress SEO version: 1.3.4.3

    I did this:
    I added add_filter( 'wpseo_title', '__return_false' ); to my theme's functions.php file (theme: TwentyTwelve)

    This is based on the example here:
    http://yoast.com/wordpress-seo-api-docs/#examples

    I expected the plugin to do this:
    I expected the <title> tags to be ignored.

    Instead it did this:
    Instead, the title tag is still being modified (its position in the <head> area changed) and it's empty.

    For example, my <head> area looks like this:

    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
    <!--[if lt IE 9]>
    <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
    <![endif]-->
    <?php wp_head(); ?>
    </head>

    But if I attempt to disable "wpseo_title", the resulting source code is:

    <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="http://mysite.com/xmlrpc.php" />
    <!--[if lt IE 9]>
    <script src="http://mysite.com/wp-content/themes/twentytwelve/js/html5.js" type="text/javascript"></script>
    <![endif]-->
    
    <!-- This site is optimized with the Yoast WordPress SEO plugin v1.3.4.3 - http://yoast.com/wordpress/seo/ -->
    <title></title>
    <!-- Admin only notice: this page doesn't show a meta description because it doesn't have one, either write it for this page specifically or go into the SEO -> Titles menu and set up a template. -->
    <link rel="canonical" href="http://mysite.com/" />
    <!-- / Yoast WordPress SEO plugin. -->
    ...
    ...
    </head>

    As you can see the <title> tags have changed position and the plugin has added comments to that area. Also my <title> is empty.

    Why doesn't add_filter( 'wpseo_title', '__return_false' ); prevent the plugin from having any effect on the title tags?

    Thanks,
    Eric

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic