• Hi.
    On activation, I got the following error
    Fatal error: Uncaught Error: Call to undefined function create_function() in ..\wp-content\plugins\santas-christmas-countdown\xmascount.php:111

Viewing 1 replies (of 1 total)
  • Thread Starter Lena Stergatou

    (@lenasterg)

    To fix it replace in file
    santas-christmas-countdown\xmascount.php line: 111
    add_action( 'widgets_init', create_function('', 'return register_widget("cw_axmascount");') );

    with:

    function cw_axmascount_register_widgets() {
    	return register_widget( 'cw_axmascount' );
    }
    add_action( 'widgets_init', 'cw_axmascount_register_widgets' );
    

    And also replace in file
    \santas-christmas-countdown\xmascount.php line: 69 the function

    function cw_axmascount()
      {
        $widget_ops = array('classname' => 'cw_axmascount', 'description' => 'Drag this widget to your sidebar to display Santa\'s Christmas Countdown.' );
        $this->WP_Widget('cw_axmascount', 'Santa\'s Countdown', $widget_ops);
      }

    with:

    public function __construct() {
    		$widget_ops = array(
    			'classname'   => 'cw_axmascount',
    			'description' => 'Drag this widget to your sidebar to display Santa\'s Christmas Countdown.',
    		);
    			parent::__construct(
    				'cw_axmascount',
    				'Santa\'s Countdown',
    				$widget_ops
    			);
    	}
Viewing 1 replies (of 1 total)
  • The topic ‘Fatal error on activation in PHP 8.1’ is closed to new replies.