Support » Plugins and Hacks » Yoast SEO » add_filter( 'wpseo_title', '__return_false' ); – doesn't work

add_filter( 'wpseo_title', '__return_false' ); – doesn't work

  • WordPress version: 3.5
    WordPress SEO version:

    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:

    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:

    <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>
    <?php wp_head(); ?>

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

    <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>
    <!-- This site is optimized with the Yoast WordPress SEO plugin v1.3.4.3 - http://yoast.com/wordpress/seo/ -->
    <!-- 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. -->

    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?



  • The topic ‘add_filter( 'wpseo_title', '__return_false' ); – doesn't work’ is closed to new replies.
Skip to toolbar