-1

An error of type E_ERROR was caused in line 29 of the file /home2/desigjnm/public_html/wp-content/themes/construction/inc/woo-config.php. Error message: Uncaught Error: Call to undefined function create_function() in /home2/desigjnm/public_html/wp-content/themes/construction/inc/woo-config.php:29 Stack trace: #0 /home2/desigjnm/public_html/wp-content/themes/construction/functions.php(292): require() #1 /home2/desigjnm/public_html/wp-settings.php(546): include('/home2/desigjnm...') #2 /home2/desigjnm/public_html/wp-config.php(101): require_once('/home2/desigjnm...') #3 /home2/desigjnm/public_html/wp-load.php(50): require_once('/home2/desigjnm...') #4 /home2/desigjnm/public_html/wp-admin/admin.php(34): require_once('/home2/desigjnm...') #5 /home2/desigjnm/public_html/wp-admin/index.php(10): require_once('/home2/desigjnm...') #6 {main} thrown

Line 29 in woo-config.php is

add_filter( 'loop_shop_per_page', create_function( '$number', 'return 12;' ), 20 );

1 Answer 1

3

create_function was removed in PHP 8.0, so your theme does not appear to be compatible with PHP 8.0+. You have several options to resolve this:

  1. If your site is down and it is important to get your site up immediately, ask your host to downgrade PHP to 7.4. Just be aware that security support for PHP 7.4 ends in a couple of days, so the sooner you can resolve this the better.
  2. Contact the theme author and find out if there is an update available that will resolve this issue, or if they can provide any support for making the theme compatible with PHP 8.0+.
  3. If, and only if, your theme is not receiving updates and the theme author is unavailable or can't help, you can update the affected code like this:
create_function( '$number', 'return 12;' ) 

Needs to become:

function( $number ) { return 12; } 

The PHP documentation has some more examples of converting create_function() into anonymous functions, which is what you need to do.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.