Title: PHP8 / Call to undefined function create_function()
Last modified: April 24, 2022

---

# PHP8 / Call to undefined function create_function()

 *  [Heat Sink](https://wordpress.org/support/users/heat-sink/)
 * (@heat-sink)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/php8-call-to-undefined-function-create_function/)
 * Just an FYI for those still supporting this plug-in on modern servers, specifically
   PHP8 which has removed `create_function()`.
 * Others have posted regarding this, but the one solution with a recommendation
   is not quite correct, so I figured I’d post this for any others in this situation.
 * In wp-spamshield.php, around line 2030, change
 * `return preg_replace_callback( $regex_phrase, create_function( '$matches', 'return'.
   $encode_method.'($matches[0]);' ), $string );`
 * to
 * `return preg_replace_callback( $regex_phrase, function($matches) use( $encode_method){
   return $encode_method($matches[0]); }, $string );`

The topic ‘PHP8 / Call to undefined function create_function()’ is closed to new
replies.

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

 * 0 replies
 * 1 participant
 * Last reply from: [Heat Sink](https://wordpress.org/support/users/heat-sink/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/php8-call-to-undefined-function-create_function/)
 * Status: not resolved