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.
THANK YOU!
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.
But when I switch back to the “nice” permalinks, I run into the same problem ALL over again. :-/
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
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!)
thanks, i have been looking for the answer too. thank god that you decided to document the solution. may god bless you.
Thanks for the post. Saved my behind.
Rob
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 !
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.
Thank you and 100 times thank you! (and to Google for bringing me to you) you have really saved me a lot of pain
Thank you!
I agree. Thanks so much for posting this. I was really nervous when I got that message and you really saved the day!
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”!
Thank you oh thank you! This really helped me fix the problem.
Thank you!! With this post, a Google search is much more productive.
Thanks so much ! this post saved me :-) I did exactly as you proposed and everything is back to normal. Than you so very much.
Thank You! It worked! I was in full panic mode there for about 10 minutes!
Thank You a lot! I today only updated to 3.3 and it was showing error. Now it is all ok.
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~!
Thanks! :)))
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…..
First, thanks for helping me solving the problem, the problem solved when i make
in Permalink Settings > choose > Post name > http://egylearn.com/sample-post/ “egylearn.com” is my site
now everything is fine, thanks again
Thx a lot for your contribution i m verry happy when a find the something true
ive a nice day
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. ;)
Thanks so much for posting this. I would have been up all night trying to figure this out.
Great information here, worked like a charm. 1 free backlink coming your way!
Hi
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
Cheers
K.C
Worked like a charm! Thanks man!!!
Thank You! You saved my Day! God Bless!
Thankssss a looooot !
your post save my afternoon !
Regards !
Many Thanks. I never would have been able to figure this out on my own!
CONFIRMED SOLUTION!
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
Akismet
All in One SEO Pack
AWeber Web Forms
Contact Form by ContactMe.com
Easy Privacy Policy
Elegant Builder
Elegant Shortcodes
Exclude Pages from Navigation
Facebook
Google XML Sitemaps
Hotfix
Jetpack by WordPress.com
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
Theme-Check
TinyMCE Advanced
WordPress Importer
WP Captcha Free
WP Customer Reviews
WP Super Popup
WP to Twitter
Thanks so much! Spent hours trying to find the solution; you are a lifesaver!
Thank you! helped!
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.
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.
Helpful for me buddy!!
Million thanks :)
Pitou
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.
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????
Thank you!!!! I have been racking my brain and searching all day on how to fix this. I knew it was something simple.
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 :)
Worked a treat, thanks!
On line up of problema type:
if ($match[0]==”?”) { $match[0]=”\?”; }
This is superb the same problem i had with my website http://www.webmagpie.com
It has been resolved by only disabling my plugins as u said
Thank u so much
DUDE I LOVE YOU!
Thank you so much!
grazieeeeeeeeeeeeeeeeeee!!!!!
thanks thanx thnx thx tx !!!!!
andrea
THANK YOU!!!!!!!!!!!!!!!!!
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!!!!
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.
FINAL NOTES
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.
For me its the plugin WP e-commerce that causes the issue.
Anyone have a fix other than:
error_reporting(0);
@ini_set(‘display_errors’, 0);
?
Thank you so much, finally found what was doing this on one of my sites.
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.
nice share, i have tried and work it…thank you very much
Your save one project !
Thx very much :D
This post saved me a lot of time. I never would have come up this on my own.
Thanks!
Thanks a lot! It worked.
Thanks. I was 90% done with the site when the error started. I was thinking I might need to restart the whole thing.
Thanks so much.
Just transferred a site and decided to update WordPress.
Appreciate the quick fix. Life saver!!!
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
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!
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 :)
Your rock man!
Thanks! This was a lifesaver.
thanks!!! Grazie!! from italy
you’ve really helped me and my site!
thanks man….
Thank you!..
Thank you!! You saved me a lot of frustration!!
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.
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
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.
gracias la verdad me fue muy util desde venezuela
Fantastic… you only have one problem. No donate button on your site for this solution. Thanks dude! :D
Life saver, thanks a lot !
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!
Thank you very much!!! You just saved life!!! :****
Thank you so much for your solution !! It work’s for me too.
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.
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. :)
Thanks!
Your really have me! This deserves a video !!
Thank you! A quick fix in under 10 minutes.