Fatal error cannot redeclare class TextStatistics Easy WP Seo

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:

http://code.google.com/p/php-text-statistics/

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.

 

15 Responses to “Fatal error cannot redeclare class TextStatistics Easy WP Seo”

  1. 4logpc

    It says to download a zip file…but i cant seem to find the zip file

    Reply
    • PCRepairMan

       @4logpc Wow, that’s fast, I only just wrote the article! I have uploaded the file now, wanted to get the article indexed as I know a lot of people are struggling to get this sorted.

      Reply
      • 4logpc

         @PCRepairMan yea its crippling me…that Easy SEO PLugin is the only way i can get my writers to practice SEO…its like when it goes green they do a happy dance

        Reply
        • PCRepairMan

           @4logpc Heh, mine too. With the latest Google algorithm changes it pays to ease back on the bolding and italicizing though.
           
          Hope the mod helps, please let me know.

          Reply
        • 4logpc

           @PCRepairMan thanks for the heads up, I am trying the fix right now

          Reply
        • 4logpc

           @PCRepairMan Sadly its now causing another conflict with a different plugin. Im not sure if im doing something wrong or not.

          Reply
        • 4logpc

           @PCRepairMan Honestly…Yoast’s new features do mostly the same thing…im thinking about just switching…what do you suggest as being a webmaster?

          Reply
        • PCRepairMan

           @4logpc It has to be your call. I have seen that this fix works on several setups, it’s probably your other plugin that doesn’t check if the TextStatistics class is called too. Out of interest, what is that plugin, I’ll try to help?

          Reply
        • 4logpc

           @PCRepairMan I appreciate the help, but I think im gonna just switch to yoast. Thanks for the help

          Reply
  2. AndreaDuponte

    Excellent work thanks! I was beginning to wonder if I would have to reinstall WordPress on 7 websites. Anywhere I can donate a few drinks for you?

    Reply
  3. EveMarshall1

    You’re the man!! Had nowhere to go and ALL of my sites were down. Really, thank you sooooo much!!

    Reply
  4. Sreejesh

    I was kept clueless on how to fix it, nor the developer was ready for help. Thanks for this solution, it worked!

    Reply

Leave a Reply