Modifying the Thesis Theme to Work with WordPress SEO Plugin by Yoast

I share the view of other WordPress developers who believe that SEO functionality should not be incorporated into a WordPress theme – it should be in a plugin. This promotes modularity and maintainability and avoids vendor lock-in. If you ever want to change the visual appearance of your WordPress site, your site’s SEO will not suffer.

One of the key selling points of the Thesis Theme – one of the best known premium themes for WordPress – was its inbuilt support for SEO. At the time that the Thesis Theme was first released, its inbuilt SEO features may have been equal to or superior to separate SEO plugins, but times have changed. I am not as critical of the Thesis theme’s native SEO capabilities as some other people, but one definitely can do a better job using some of the SEO plugins out there.

One highly-rated SEO plugin is WordPress SEO by Yoast (Joost de Valk).

Unfortunately, if you attempt to activate this plugin whilst using the Thesis Theme, you will have the problem of duplicate meta tags. You see, the Thesis Theme does not have a configuration option to disable its own HTML meta tag generation. As a result, when you access a page, it will contain both Thesis’s SEO meta tags those generated by the WordPress SEO plugin, which is likely to confuse search engines.

We will need to directly edit the Thesis Theme’s core files to add some code to detect if the WordPress SEO plugin is active and disable the Thesis Theme’s native meta tag generation.

Note 1: This advice only applies to version 1 of the Thesis Theme; version 2 was released late last year, but as of this currrent time, the majority of people using the Thesis Theme are still running version 1.

Note 2: make sure you make backups of all files you edit, just in case anything goes wrong

The file in question is lib/classes/head.php, relative to the Thesis Theme root folder or wp-content/themes/thesis_185/lib/classes/head.php from the WordPress root folder.

On Line 12, there is a call to the method meta().

$head->meta();

We will modify this line to only run the method if the WordPress SEO plugin is not detected.

if (!defined('WPSEO_VERSION')) $head->meta();

The constant WPSEO_VERSION is defined by the WordPress SEO plugin. This is a short-cut method for detecting if it’s activated. Although this is not the official WordPress method of checking for the presence of another plugin, it has the lowest overhead at runtime.

Thesis Theme and All-In-One SEO Pack Plugin

The Thesis theme has some native support for another popular WordPress SEO plugin – All In One SEO Pack.

Whilst analysing the Thesis Theme, I discovered the following on line 122 of this lib/classes/head.php

if (!class_exists('All_in_One_SEO_Pack')) {

In this case, if All In One SEO Pack plugin is enabled, the Thesis Theme will suppress its native generation of the title and description meta tags, BUT Thesis will still generate its own robot meta tags.

If you want to use the All In One SEO Pack plugin and are prepared to accept the above limitation, then you don’t need to do anything.

However, If you want to entirely suppress all of Thesis’s header meta tags, just as we did with the WordPress SEO plugin by Yoast, then make this change to line 12:

if (!class_exists('All_in_One_SEO_Pack')) $head->meta();

Other Consequences of Making This Modification to the Thesis Theme

In the post/page editor, Thesis’s meta box “SEO Details and Additional Style” will remain present even after you enable WordPress SEO. The first four settings “Custom Title Tag”, “Meta Description”, “Meta Keywords” and “Robots Meta Tags” can be edited, but they will be ignored by WordPress SEO, in favour of its own settings

If you disable the WordPress SEO plugin, the Thesis Theme’s native SEO meta tag functionality will be automatically re-enabled and any meta tag settings you previously had in Thesis’s meta box will be used

If you want to migrate your Thesis Theme’s existing SEO meta tags to WordPress SEO (or a number of other WordPress SEO plugins), there is a plugin for that! It’s called SEO Data Transporter