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.

You may also like...

82 Responses


    I have looked for an answer for about 10 days on this. I had the same errors and after trying this – I am back up with permalinks.

  2. Juno says:

    But when I switch back to the “nice” permalinks, I run into the same problem ALL over again. :-/

  3. Albright says:

    Did you make sure all your plugins were disabled still when switch back to the permalinks structure you wanted? I ran into the problem you mentioned when I did not have the plugins disabled. You should be able to re-enable the plugins AFTER switching back to your desired structure

  4. Juno says:

    Yes, all plugins disabled. After switching them back on (no matter if it was one by one or all of them in one fell swoop), everything seems okay until I try editing a page or post. Then the error shows up again … After lots of testing I think it’s maybe caused by the Now Reading plugin. (Though that’s really weird because I use the same WordPress version and plugin version for another blog as well, and I don’t get those errors over there!)

  5. wawa says:

    thanks, i have been looking for the answer too. thank god that you decided to document the solution. may god bless you.

  6. Rob Holmes says:

    Thanks for the post. Saved my behind.


  7. StandarT says:

    Thanks too ! your post save me. I had this problem after installing WP super cache plugin. So, to solve it, I uninstall only this plugin, Go to the Permalinks settings (under the Settings header in the admin dashboard). and switch back to the value default. A refresh on my home page, now it rocks !

  8. OMG! Thank you so much for this post. I had been fighting with my site for 2 hours and your idea fixed it in 5 minutes.

  9. Nick says:

    Thank you and 100 times thank you! (and to Google for bringing me to you) you have really saved me a lot of pain

  10. Elorm says:

    Thank you!

  11. Donna says:

    I agree. Thanks so much for posting this. I was really nervous when I got that message and you really saved the day!

  12. Nash says:

    THANKS!!!…And I use Joomla!!…All I had to do was remove a number from a permalink that had been set for a blog post through my blogging interface “Easyblog”!

  13. Norie says:

    Thank you oh thank you! This really helped me fix the problem.

  14. Jared says:

    Thank you!! With this post, a Google search is much more productive.

  15. Eknath says:

    Thanks so much ! this post saved me :-) I did exactly as you proposed and everything is back to normal. Than you so very much.

  16. CP says:

    Thank You! It worked! I was in full panic mode there for about 10 minutes!

  17. Deepak says:

    Thank You a lot! I today only updated to 3.3 and it was showing error. Now it is all ok.

  18. aprillins says:

    You ARE my life saver!

    If I can tell you, The error was 250mb in an error_log.. but now it’s gone because I’ve applied your solution

    thanks in advance dude~!

  19. Yaniv says:

    Thanks! :)))

  20. volker says:

    Hey this works perfekt… thanks a lot you saved me a lot of Time..
    Thank you Thank you Thank youThank youThank youThank youThank youThank youThank you…..

  21. says:

    First, thanks for helping me solving the problem, the problem solved when i make
    in Permalink Settings > choose > Post name > “” is my site
    now everything is fine, thanks again

  22. ekpale says:

    Thx a lot for your contribution i m verry happy when a find the something true
    ive a nice day

  23. Ariane says:

    Thank you so much for this post! Through your advice (switching the permalink to default and back) I’ve saved what would have probably been a day of stress.

    I salute you. ;)

  24. Thanks so much for posting this. I would have been up all night trying to figure this out.

  25. Great information here, worked like a charm. 1 free backlink coming your way!

  26. K.C says:


    I have upgraded to new WP version and this started appearing when I click on menu links. The site has WP Ecommerce Installed and there was many other suspects.

    I thoughts its a problem with the perma links and tried the old trick (saving permalink structure twise) but it did not work.

    Then I found your post and it worked for me like a charm. Thank you verymuch for your post



  27. Leif Hurst says:

    Worked like a charm! Thanks man!!!

  28. Thank You! You saved my Day! God Bless!

  29. Barbara says:

    Thankssss a looooot !
    your post save my afternoon !

    Regards !

  30. Many Thanks. I never would have been able to figure this out on my own!

  31. Alain Hernandez says:


    I also came across this issue right after upgrading my wordpress website from 3.4 to the new 3.5 Version. After several hours of troubleshooting I came to the bottom of the issue. Please read below to also fix your problem.

    The Problem was caused due to One of the Plugins you are using was not compatible with the 3.5 upgrade. There is no need to stay on 3.4, I highly recommend to install 3.5 and that is because wordpress released it for a reason and that is so that you have the most recent wordpress application so get it. Once you install it, then follow the steos below.

    ***Steps to Remove the Error messages***

    Step 1. Disable all Plugins at once
    Step 2. Go to Settings/Permalinks
    Step 3. For Recommended SEO use the Custom Structure /%category%/%postname%/ and save

    Refresh the website and the problem should got fix. Once you confirm this, please follow the steps below.

    ***Steps to put back your previous plugins***

    Step 4. Go back to the Plugins List
    Step 5. Open a New Browser with your Website on it under the page that was giving you the error.
    Step 6. Activate One Plug in at a time (DO NOT INSTALL ALL AT ONCE), each time you activate a plugin. Go back to the second tab and refresh the page. If after refresh the problem did not come back, then you know that the plugin you recently activated is good to go.
    Step 7. Continue to activate and refresh one by one. Once you finish activating all plugins then you good to go.
    Step 8. After installing all my plugins back one by one I never saw the problem again. So I was not able to identify a plugin issue because they all activated again fine.

    The Following Plugins are good to go and they checked out ok without bringing the issue back…………….

    AddThis Follow Widget
    AddThis Social Bookmarking Widget
    AddThis Welcome Bar
    All in One SEO Pack
    AWeber Web Forms
    Contact Form by
    Easy Privacy Policy
    Elegant Builder
    Elegant Shortcodes
    Exclude Pages from Navigation
    Google XML Sitemaps
    Jetpack by
    MaxBlogPress Ping Optimizer
    OnlyWire for WordPress [OFFICIAL]
    Pretty Link Lite
    PunchTab for WordPress
    Secure WordPress
    SEO Friendly Images
    SEO Smart Links
    Social Login
    Social Network Tabs
    TinyMCE Advanced
    WordPress Importer
    WP Captcha Free
    WP Customer Reviews
    WP Super Popup
    WP to Twitter

  32. Janese says:

    Thanks so much! Spent hours trying to find the solution; you are a lifesaver!

  33. Ilya says:

    Thank you! helped!

  34. Jayden says:

    Didn’t work for me.

    1. Deactivated all plugins
    2. Set permalinks to default, and saved
    3. Set permalinks to Post name /%postname%/ – saved
    4. Checked and confirmed it all worked
    5. Reactivated plugins – not working again.

  35. Albright says:

    It seems certain a plugin is the issue, I would have to recommend trying to reactivate your plugins one at a time, that should narrow it down.

  36. Pitou says:

    Helpful for me buddy!!

    Million thanks :)

  37. Staci says:

    Thank you. You saved me a big headache. I deleted a RSS feed plugin and I went back to the default permalink structure under settings. I had a custom structure setup.

    Thanks again.

  38. Sonya says:

    Just tried these steps and the warnings are gone. BUT my website reverted to the basic theme where none of the backgrounds/pics/formatting is what it is supposed to be. Is there away for me to fix this problem????

  39. Steven says:

    Thank you!!!! I have been racking my brain and searching all day on how to fix this. I knew it was something simple.

  40. Turina says:

    You’re a ledgend! Thank you so much. I already have an ongoing problem and then came home to this one after a day out, after I changed the permalinks last night. Changed back and all is good with the world again :)

  41. Alan says:

    Worked a treat, thanks!

  42. Tiago says:

    On line up of problema type:

    if ($match[0]==”?”) { $match[0]=”\?”; }

  43. vans says:

    This is superb the same problem i had with my website
    It has been resolved by only disabling my plugins as u said

    Thank u so much

  44. Nayem says:


    Thank you so much!

  45. andrea says:

    thanks thanx thnx thx tx !!!!!


  46. Nichole says:

    THANK YOU!!!!!!!!!!!!!!!!!

  47. james gamble says:

    AHH THANKYOU!!!!!!

    I had to mess with the permalink settings beforehand with my previous template since it wasnt working properly and had to add in a plugin and manually change the links to the pages. Thank you! Now everything is fixed and I can use the new template as intended with much ease!!!!

  48. Alain Hernandez says:

    After carefully testing I came to find out that the main source for this type of Error with WordPress is a Plugin Malfunction and Conflict with another Similar Function know as Load Timeout.

    The Main Source for this error was related to the NEW JETPACK update which updates new features within it’s Options. Please follow the steps below for troubleshooting and fix…

    Option One
    If after Disabling all existing plugins and reactivating them you still experiencing this issue then follow the steps below.

    Disable the Jetpack Plugin and leave the rest enable as they are now. See if the issue goes away, if it does then the main problem is one or more of the feature options within the plugin. Reply back to me for further instructions. If the issue does not go away then is not your jetpack and is another plugin which conflicts with an already function on your site. Follow Option 2 if this is the case.

    Option Two
    If after following the above step you still get this error message then please follow the steps below.

    Disable All Plugins, once you do that then select all plugins that have an update available and update them all at one time.

    Once you have done this now what you want to do is Enable One plugin at a time, to help you identify which one is the cause please Enable the ONES that you NEED MOST one by one LEAVING the NOT REALLY NEED ones for last and move your way down until you enable one that makes the same error appear.

    To be able to test this, make sure to Enable One Plugin and then open a new Windows showing your websites home website and see if it came back or not. If it did not then you good, move on to the next one and again refresh your home page and see and so on.

    You will find that almost all will enable back without an issue and you may need to configure some of them back to it’s previous settings but you will see that ONE is the cause and once you find it then Disable it back up and leave it OFF and try to contact the plugin creator or if is not really need it screw it lol.

    I think this is going to set you straight, I dealt with this many times and each time it varies on the cause but it mainly comes down on a plugin malfunction or conflict with an already function of your website.

    If you need additional help, reply to this thread or Click on my name and contact me on my website if need be.

  49. Zurp says:

    For me its the plugin WP e-commerce that causes the issue.
    Anyone have a fix other than:

    @ini_set(‘display_errors’, 0);


  50. Mike says:

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

  51. Radoslav says:

    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.

  52. orgilican says:

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

  53. Loïc Tortelier says:

    Your save one project !
    Thx very much :D

  54. DarthJay says:

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


  55. Jack says:

    Thanks a lot! It worked.

  56. Fred says:

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

  57. Richard says:

    Thanks so much.

    Just transferred a site and decided to update WordPress.

    Appreciate the quick fix. Life saver!!!

  58. Chris says:

    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.


  59. Ryan says:

    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!

  60. eric kindley says:

    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 :)

  61. Erik says:

    Your rock man!

  62. Probe says:

    Thanks! This was a lifesaver.

  63. antonio says:

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

  64. riche says:

    thanks man….

  65. ProfessorX says:

    Thank you!..

  66. Dick Donohue says:

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

  67. Cliff says:

    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.

  68. Mal says:

    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

  69. Alain Herndez says:

    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.

  70. edgar zurita says:

    gracias la verdad me fue muy util desde venezuela

  71. Fox says:

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

  72. Ram says:

    Life saver, thanks a lot !

  73. 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!

  74. Alice''' says:

    Thank you very much!!! You just saved life!!! :****

  75. Diane says:

    Thank you so much for your solution !! It work’s for me too.

  76. Sharon says:

    Thank you, thank you, thank you!!! I was terrified that this was going to eat up my whole day trying to fix this. I found your post and the problem is solved in less than 5 minutes.

  77. It’s amazing how seven years later this is still helping people. Thank you for your post and for all those who commented throughout the years. It’s the recent comments that help prove this is still a viable solution.

    For me, I was able to reset the permalinks without turning off my plugins (thank the gods). Your mileage may vary, of course. :)

  78. MWOC says:


  79. David says:

    Your really have me! This deserves a video !!

  80. Tudou says:

    Thank you! A quick fix in under 10 minutes.

  1. June 4, 2012

    […] for me and hopefully will be super helpful and save you time too. Based on simple instructions from Share this:TwitterFacebookLike this:LikeBe the first to like this […]

  2. October 31, 2019

    […] SOLVED! Fix WordPress Error – Warning: preg_match() [function.preg-match]: Compilation failed: not… […]

Leave a Reply

Your email address will not be published. Required fields are marked *