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

March 21, 2013 9 Email article | Print article

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!

9 Comments »

  1. Trev (Down Under) March 22, 2013 at 2:05 PM (comment permalink) -

    Well Ashraf for the first time you lost me on this one :). I will do some googling and find out what it is about.

    1
  2. Ashraf March 22, 2013 at 2:09 PM (comment permalink) -
    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.

    2
  3. joon March 31, 2013 at 6:24 PM (comment permalink) -

    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!)

    3
  4. joon April 2, 2013 at 4:48 AM (comment permalink) -

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

    4
  5. joon April 2, 2013 at 4:57 AM (comment permalink) -

    [@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
  6. Ashraf April 2, 2013 at 10:29 AM (comment permalink) -
    Mr. Boss

    [@joon] Yes, that is exactly what it means.

    [@joon] Thanks, fixed.

    6
  7. joon April 2, 2013 at 8:40 PM (comment permalink) -

    [@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 :)

    7
  8. joon April 3, 2013 at 2:58 AM (comment permalink) -

    [@Ashraf]

    Also our challenge will be how to do this in Multisite??? because post ID is different for Multisite???

    8
  9. Robert April 3, 2013 at 11:26 AM (comment permalink) -

    I checked with Simple Press and they say it doesn’t seem to be an issue, you just have to turn on “ugly permalinks” in Yoast and it should work fine.

    http://simple-press.com/support-forum/sp5-general-topics/does-yoast-seo-wordpress-plugin-work-with-simple-press/#p124489

    9

Leave A Response »