Title: &quot;Deprecated&quot; warning
Last modified: August 31, 2016

---

# "Deprecated" warning

 *  [Salvatore](https://wordpress.org/support/users/scapolupogmailcom/)
 * (@scapolupogmailcom)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/deprecated-warning-5/)
 * Using newest version of WordPress, I can see in debug mode this warning:
 * `Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback
   instead in /Applications/AMPPS/www/mysitetest/wp-content/plugins/wp-code-highlight/
   wp-code-highlight.php on line 68`
 * Hope it could be useful
 * [https://wordpress.org/plugins/wp-code-highlight/](https://wordpress.org/plugins/wp-code-highlight/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [simone.camporeale](https://wordpress.org/support/users/simonecamporeale/)
 * (@simonecamporeale)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/deprecated-warning-5/#post-7028144)
 * Hi,
    you could fix that warning editing wp-code-highlight.php files located in**
   wp-content/plugins/wp-code-highlight/wp-code-highlight.php** Comment line 67-
   68 and add this line:
 *     ```
       //return preg_replace("/<pre(.*?)>(.*?)<\/pre>/ise",
       //      "'<pre class=\"wp-code-highlight prettyprint$line_numbers\">'.wch_stripslashes('$2').'</pre>'", $content);
   
       return preg_replace_callback("/<pre(.*?)>(.*?)<\/pre>/is",function($m) { return '<pre class=\"wp-code-highlight prettyprint$line_numbers\">'.wch_stripslashes('$m[2]').'</pre>'; },$content);
       ```
   
 *  [pauguillamon](https://wordpress.org/support/users/pauguillamon/)
 * (@pauguillamon)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/deprecated-warning-5/#post-7028149)
 * Hi,
 * Just updated my PHP version from 5.4 to 7 and I was getting that error too. Your
   solution, @simone-camporeale, didn’t completely worked for me. I was getting 
   literally this in each pre:
 *     ```
       $m[2]
       ```
   
 * So I have modified simone.camporeale solution, and got this one that is working
   for me:
 *     ```
       return preg_replace_callback("/<pre(.*?)>(.*?)<\/pre>/is",function($m) { return '<pre class="wp-code-highlight prettyprint'.$line_numbers.'">'.wch_stripslashes($m[2]).''; },$content);
       ```
   
 * Note it’s almost the same, but modifying a little bit the pre tag’s class and
   removing the apostrophes in the wch_strpslashes() parameter.
 * EDIT: sorry for editing a lot. First time posting here and I was trying to figure
   out how to correctly put code in the code blocks.
 * EDIT2: btw, I had to check all my code snippets since, on some, some symbols 
   like & or > were automatically changed to the HTML name (& amp; and & gt; respectively)
 *  [Michael Visser](https://wordpress.org/support/users/visser/)
 * (@visser)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/deprecated-warning-5/#post-8185534)
 * Hi [@pauguillamon](https://wordpress.org/support/users/pauguillamon/), noticed
   that your snippet is missing the closing element in case others are using your
   patch.
 * `return preg_replace_callback("/<pre(.*?)>(.*?)<\/pre>/is",function($m) { return'
   <pre class="wp-code-highlight prettyprint'.$line_numbers.'">'.wch_stripslashes(
   $m[2]).''; },$content);`
 *  [hoelli](https://wordpress.org/support/users/hoelli/)
 * (@hoelli)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/deprecated-warning-5/#post-8666010)
 * [@michael](https://wordpress.org/support/users/michael/) Visser: Sorry, but you
   also forgot the closing pre tag.
 * Here’s the code that works for me ATM.
 *     ```
       //	return preg_replace("/<pre(.*?)>(.*?)<\/pre>/ise",
       //		"'<pre class=\"wp-code-highlight prettyprint$line_numbers\">'.wch_stripslashes('$2').'</pre>'", $content);
       return preg_replace_callback("/<pre(.*?)>(.*?)<\/pre>/is",function($m) { return '<pre class="wp-code-highlight prettyprint'.$line_numbers.'">'.wch_stripslashes($m[2]).'</pre>'; },$content);
       ```
   
 *  [Michael Visser](https://wordpress.org/support/users/visser/)
 * (@visser)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/deprecated-warning-5/#post-8668012)
 * *headsmack* Thanks [@hoelli](https://wordpress.org/support/users/hoelli/), we’ll
   get there on the third attempt (or more) 😉

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘"Deprecated" warning’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-code-highlight.svg)
 * [WP Code Highlight](https://wordpress.org/plugins/wp-code-highlight/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-code-highlight/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-code-highlight/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-code-highlight/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-code-highlight/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-code-highlight/reviews/)

 * 5 replies
 * 5 participants
 * Last reply from: [Michael Visser](https://wordpress.org/support/users/visser/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/deprecated-warning-5/#post-8668012)
 * Status: not resolved