Problem: You try to save a draft, publish or update a post in WordPress and you get:
Fatal error: Cannot redeclare class TextStatistics in /home/nasalcon/public_html/wp-content/plugins/easywpseo/onpageseo-readability.php on line 35
This is caused by a conflict between Yoast’s excellent WP SEO plugin and the (equally excellent) Easy WP SEO plugin. It was triggered on the v1.2 update of the Yoast plugin that happened on 12th June 2012. Now I’ll make it clear that the problem does not appear to be with Yoast’s plugin, it seems to be the fact that both are using the php Text Statistics code released here:
I have contacted the developer of EasyWP SEO but, to date, have had no reply. Since it renders a website unable to create posts, I thought I’d better write a fix for my clients and for those of you who use both plugins. I have added a small text link to this article in case the developer updates the plugin, I’ll let you know here if he does.
Many people use Yoast’s plugin for its useful sitemap and meta description functionality and have no need for the SEO scoring tools that were introduced in the last update as they use alternative plugins.
The TextStatistics fix
What I have done is modified the code to temporarily disable the calls to the readability class within Easy WP SEO. Most, if not all of my clients do not use the Flesch-Kincaid Reading Ease tests in the ‘Readability’ section so this has no adverse effect.
To apply my fix, you’ll need to update just 2 files on your server. I presume that you are familiar with FTP and unzipping, let me know if not. I’ll also presume you are running the latest version of Easy WP SEO (v1.6 or 1.6.2), I am unable to check any backwards compatibility. My method does create backups of both files though so should be very safe.
Download the zip file here (UPDATE – THIS IS NO LONGER NECESSARY, THE AUTHOR HAS NOW FIXED THE PROGRAM) and follow this method:
- Extract the files onto your desktop, they’ll be in a folder called PCRMB-EWPSEO-fix-v1.
- Using an FTP client, navigate to wp-content/plugins/easywpseo/ and rename the file “onpageseo-admin.php” to “onpageseo-adminBAK.php“
- Copy the extracted file “onpageseo-admin.php” from your new desktop folder to wp-content/plugins/easywpseo/
- Now navigate to wp-content/plugins/easywpseo/templates/ and rename the file “admin-score-metabox.php” to “admin-score-metaboxBAK.php“
- Copy the extracted file “admin-score-metabox.php” to wp-content/plugins/easywpseo/templates/
Create a test post and fill in some keywords in the Easy WP SEO box. You should now have no conflict between Yoast’s WP SEO and Easy WP SEO.
Please note that you should not fill in the WP SEO ‘Focus Keyword’ as you are choosing to keep the more graphical Easy WP SEO tool as the primary SEO scoring indicator.
Please drop me a comment below or click one of the social buttons if this helped you. Also please let me know if you get any other errors.