WordPress – Crayon Plugin bugfix

After install Crayon Syntax Highlighter version 2.8.4 there seems to be a bug when creating a new post.

Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/.si78/tes/8site7062213/web/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

This issue was also reported and here and a fix was mentioned, but not here.

To fix the issue the regex has to be corrected:

#OLD
return preg_replace('/[^\w-+#]/msi', '', $id);

#NEW
return preg_replace('/[^\w\-+#]/msi', '', $id);

Leave a Reply

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