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!

Related Posts