Working again: Fix for the preg_replace problem
-
SEO Auto Links is IMHO the most effective autolinking plugin out there. Unfortunately, it won’t work under PHP 7. I had a look at the code regarding the preg_replace warning and came to this fix by replacing the deprecated preg_replace function and the /e modifier with the preg_replace_callback function.
In seo-auto-links.php Line 79:
Replace
$text = preg_replace('%(<h.*?>)(.*?)(</h.*?>)%sie', "'\\1'.SEOAutoInSpecChar('\\2').'\\3'", $text);with
$text = preg_replace_callback('%(<h.*?>)(.*?)(</h.*?>)%si', function($m) { return $m[1].SEOAutoInSpecChar($m[2]).$m[3]; }, $text );In seo-auto-links.php Line 258:
Replace
text = preg_replace('%(<h.*?>)(.*?)(</h.*?>)%sie', "'\\1'.SEOAutoReSpecChar('\\2').'\\3'", $text);with
$text = preg_replace_callback('%(<h.*?>)(.*?)(</h.*?>)%si', function($m) { return $m[1].SEOAutoReSpecChar($m[2]).$m[3]; }, $text );After this modification, it should work fine again.
MD
The topic ‘Working again: Fix for the preg_replace problem’ is closed to new replies.