How to make Yoast WordPress SEO work with Simple:Press (page title and canonical) [Guide]

yoastFor the longest time I used All In One SEO on dotTech. All In One SEO works fine but Yoast WordPress SEO allows a lot more flexibility and is, in my open, an overall better SEO plugin for WordPress. However, if you have Simple:Press forums installed then you may notice Yoast WordPress SEO does not work well with Simple:Press’s built-in SEO features. Most importantly, Yoast WordPress SEO overrides Simple:Press’s built-in SEO title and canonical links and replaces them with generic title and link of your page as opposed to of the forums, which results in Google not properly indexing your forums.

Unfortunately, there is no built-in functionality in Yoast SEO WordPress to make it play well with Simple:Press. Fortunately, there are two simple tricks you can apply to make Yoast SEO WordPress play well with Simple:Press; these two tricks make it so Yoast SEO WordPress does not override Simple:Press’s built-in SEO title and canonical links, meaning Google will be able to properly index your forums and you can still enjoy the benefits of Yoast SEO WordPress.

Interested? Let’s get started.

BEFORE WE BEGIN

Before we begin, you need to find the page ID of the page you display Simple:Press on. This can be found by logging into WordPress, going to ‘Pages’, and edit the page you display Simple:Press on. When editing the page, look at the address bar in your browser. The number after “post=” is the page ID you need:

2013-03-21_213112

Copy this page ID. You will need it to perform these tricks.

HOW TO FIX YOAST WORDPRESS SEO PAGE TITLE AND CANONICAL LINKS FOR SIMPLE:PRESS

To make Yoast WordPress SEO and Simple:Press work well together, do the following:

  • Using an FTP program or however you like to access your website files, find and open ‘header.php’ of your WordPress theme.
  • In header.php, replace…

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

…with…

<title><?php if(get_the_id() == 6992) { echo the_title(); } else { wp_title(); } ?></title>

Make sure in place of “6992” you input the page ID you found earlier.

  • Save header.php and upload it to your website. Close it when you are done.
  • Now open ‘functions.php’ and add the following to the end:

function wpseo_canonical_exclude( $canonical ) {
global $post;
if ( $post->ID == 6992) {
$canonical = false;
}
return $canonical;
}
add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );

Make sure in place of “6992” you input the page ID you found earlier.

  • Save functions.php and upload it to your website. Close it when you are done.
  • Repeat these same steps if you have a mobile theme.
  • Done!

After doing both these steps, Yoast WordPress SEO will no longer replace Simple:Press page title and canonical URLs with generic ones; Google will now properly index Simple:Press forum pages and you can continue to use Yoast WordPress SEO like normal.

After you do the above, to customize the way Simple:Press displays page titles, go to Simple:Press’s ‘Components’ -> ‘SEO’ section in settings.

CONCLUSION

Enjoy!

Share this post

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

11 comments

  1. Heather

    For anyone this might help. Without adding the code above, The main forum title is showing in the title as expected, but we need the forum section or forum post title to show for the title instead so we don’t have over a hundred duplicate titles from the forum. This was the simple solution:

    to the theme’s functions.php

    function forumtitle() {
    $urlparts = explode(“/”,$_SERVER[“REQUEST_URI”]);
    $title=ucwords(str_replace(“-“,” “,$urlparts[count($urlparts)-2]));
    if ($title == ‘Forum’) { $title = ‘**** *** **** *****'; }
    return $title;
    }

    In the header.php (id of course being the forum’s main page id #)

    I’m now going to use that same if statement to add the title to the end of the description tag so those aren’t duplicate anymore also.

    If this is helpful to anyone, be sure to replace the asterisks in the line in the function to whatever you want your forum landing page title to be. Our page slug is forum, so we wanted the inital forum title on that landing page.

  2. Bill

    Okay, I have done what you have listed above. However, When im editing the page. Do I have to put a keyword and a meta description with Yoast SEO? Also, do which meta data options do I need to have on? This is my first forum and I want my forum topics to get indexed. Thanks though

  3. joon

    [@Ashraf]

    This is really really helpful. Thank you very much, Ashraf. WordPress.com had some ideas about wpseo_canonical_exclude but Thank you for organizing this for other people :)

    One more question. How did you manage to index Simple Forum XML?? It seems it only supports Google XML Plugin, but this plugin doesn’t support Multisite.

    We would really appreciate it if you could share your expertise with us :)

  4. joon

    [@joon]

    NOW i know why it didn’t work. the code above has errors

    it’s supposed to be add_filter( ‘wpseo_canonical’, ‘wpseo_canonical_exclude’ );

    using correct ‘ ‘ not ‘’

    if you have an html editor, you will know what i mean

  5. joon

    Unfortunately, the second code,

    function wpseo_canonical_exclude( $canonical ) {
    global $post;
    if ( $post->ID == forum#) {
    $canonical = false;
    }
    return $canonical;
    }
    add_filter( ‘wpseo_canonical’, ‘wpseo_canonical_exclude’ );

    didn’t work for me. I am wondering is other people have implemented this??

  6. joon

    thank you for the post. really can be a life-saver.

    but I am just wondering what you mean by

    “Most importantly, Yoast WordPress SEO overrides Simple:Press’s built-in SEO title and canonical links and replaces them with generic title and link of your page as opposed to of the forums, which results in Google not properly indexing your forums.”

    Does it mean that Yoast doesn’t allow Simple:Press forum to get indexed??

    I have just implemented those two plugins and can’t really find big problems (without tweaks) but wanted to investigate other important issues (such as indexing!)

  7. Ashraf
    Author/Mr. Boss

    [@Trev (Down Under)] This is for website admins who run WordPress and use Yoast WordPress SEO and Simple:Press forums. Nothing the average Joe needs but I ran into this issue and couldn’t find an easy answer so thought I should post what I found to work.