Amazon.com Widgets
rssRSS: SubscribeComments


SOLVED! Fix WordPress Error – Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in [root]/wp-includes/classes.php on line 210 211

The Problem

Recently I was unfortunate enough to get a random error while editing some articles in WordPress. All I had done was update a few articles and made no major changes to anything. Suddenly, on most pages of the site – and even in the wordpress admin dashboard, I would get the following error repeated a dozen or more times at the top of the page:

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in [yoursite]/wp-includes/classes.php on line 210

Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 in [yoursite]/wp-includes/classes.php on line 211

At one point, while browsing through different categories, I also received the following error and the page did not even load fully:

Warning: Cannot modify header information – headers already sent by (output started at [yoursite]/wp-includes/classes.php:210) in [yoursite]/wp-includes/pluggable.php on line 890

The Solution!

Luckily, after a few hours of some very unhelpful google research, then plenty of trial and error on my end, I was able to find the solution.

The problem apparently was caused by some sort of corruption with the permalinks structure. Also pointing to this fact is that lines 210 and 211 in classes.php (see the error message) have to do with permalink searching / matching if you read around a bit in that file. So, realizing this, I disabled all of my plugins (I believe the culprit here was probably Dean’s Permalinks Migration, but I disabled them all to be sure), then went into the WordPress Permalinks settings (under the Settings header in the admin dashboard). There I switched back to the first default setting, which is for %post_id% only, saved the settings, verified the site was now working, then switched back to my custom permalinks setting. Keep in mind plugins were disabled while doing this. This did NOT work when I had tried it earlier with plugins still enabled.

The problem was now fixed!

Also possibly of note is that my previous and current permalinks structure was set at /%category%/%postname%/ – which after further research is SEO (search engine optimization) friendly, however it is very hard on your server load and wordpress setup. This may have led partly to the problem, or it may not have. A better setup would be /%year%/%monthnum%/%category%/%postname%/ since having a numerical start to your permalinks structure fixes this problem. I will probably switch over to this in the near future.

Tagged as: , , , , , , , , ,



74 Comments

  1. Thank you so much, finally found what was doing this on one of my sites.

  2. I lost an hour wondering what is wrong with this stupid WP, and finally I found this post. You saved me at least another hour, so really thank you!

    Just save/save permalinks works by the way, there is no need to disable plugins or something else.

  3. nice share, i have tried and work it…thank you very much

  4. Your save one project !
    Thx very much :D

  5. This post saved me a lot of time. I never would have come up this on my own.

    Thanks!

  6. Thanks a lot! It worked.

  7. Thanks. I was 90% done with the site when the error started. I was thinking I might need to restart the whole thing.

  8. Thanks so much.

    Just transferred a site and decided to update WordPress.

    Appreciate the quick fix. Life saver!!!

  9. Thank you!

    There was so much conflicting info on this issue and most “solutions” were along the line of an auto mechanic telling you to turn up the radio so you can’t hear the clanking sound in your engine any more.

    This helped me reset the site and then track down the offending plug-in that was causing the ruckus.

    Thanks again for taking the time to so clearly document the issue and your resolution.

    Chris

  10. You’re a genius, I was sitting there like what the …. I didn’t do anything!! Every time I went to pages in the admin menu I got the error. Since I’m developing a site for a client I can’t have that kind of stuff appearing. So I started with a restore and that didn’t fix it. Then I was like “SERIOUSLY! WT ….”

    So then I just put in the error in google and up you came!! You’re such a life savor. Thinking how I was going to explain that to the client wouldn’t of been fun. Glad people like you are around to help out. Much appreciated!

  11. Pure genius. Took a job based on this post, 12 minutes later made $100.00 If you are ever in California look me up, I will buy you a beer :)

  12. Your rock man!

  13. Thanks! This was a lifesaver.

  14. thanks!!! Grazie!! from italy
    you’ve really helped me and my site!

  15. thanks man….

  16. Thank you!..

  17. Thank you!! You saved me a lot of frustration!!

  18. Great tip. Deactivating plugins. Defaulting permalinks. Then reverting back to standard worked. Of note, as soon as Events Manager v5.5.2 had some kind of conflict with WordPress v3.9: soon as EM was activated, pages at the base level of site got those same errors back. Repeat process, activate all plugins *other* than Events Manager and all good. Strange.

  19. Worked a treat, do as the post says. I deleted all my pages, banged my head, swore at the dog……found this it fixed it……you are a lifesaver…..thank you

  20. The best way to fix this issue is to disable all plugins or the most recent one you activated. If you do not have a clue which plugin is causing this error, then disable all and one by one activate the plugins until you see where the fix happens.

  21. gracias la verdad me fue muy util desde venezuela

  22. Fantastic… you only have one problem. No donate button on your site for this solution. Thanks dude! :D

  23. Life saver, thanks a lot !

  24. Hi man. Thanks for your help. Day saved!

    Worked when I defaulted to post ID option; but then when I went back to custom it kept messing up. Spotted Cliffs response and noticed he mentioned Events Manager; So I deactivated that and the problem was solved.

    Cheers guys!

Leave a Response