How to Fix Page Preview preg_match_all Warning Enfold Theme

, ,

Beginning around Enfold v4.5.1 we noticed that when previewing the changes made to a page or post we would receive the following PHP warning message.


Warning: preg_match_all(): Compilation failed: unknown property name after \P or \p at offset 6440 in /wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/shortcode-parser.class.php on line 607


Our brief research into this issue showed that it is related to some sort of conflict with another plugin. However, it isn’t a pressing issue as it is only a warning. But it is still annoying which is why we have come up with a quick patch to mute these warning messages.


Turn off PHP Error Reporting

One of the support moderators on the Enfold theme support forums suggested users simply turn off PHP error reporting by inserting the following tag into your child-theme’s functions.php: error_reporting(0);

Not an ideal nor satisfactory solution in our opinion, but it will work. Another possibility is to mute warning messages only for the offending line of code. Which is what we prefer.


Mute Warning Messages

The following is a hard code into the main Enfold theme. This means that the patch will be overwritten upon the next update. But it appears they (Kriesi) won’t be fixing this issue anytime soon based upon the replies we received on our support request post.

A quick patch to “mute” error messages on the “preg_match_all” function would be to add an “@” to the front of line 607 within shortcode-parse.class.php

We have tested it and see that our shortcodes are still functioning. No more error notices upon preview and it doesn’t get reported in the server’s error_log





LINE 607:

@preg_match_all( “/” . ShortcodeHelper::get_fake_pattern( false, $shortcodes ) . “/s”, $text, $sc_found, PREG_OFFSET_CAPTURE );


We will try again to reach out (this time directly) to the developers at to see about implementing a better, more permanent, solution to this minor yet annoying issue. In the meantime this patch will have to suffice on the accounts that frequently access the preview feature.


If you found this article helpful, please take a moment to like us on Facebook, share this on your social media. Let us know if you have any questions that we may be able to assist you with.