Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter deug7

    (@deug7)

    I fixed my issue by changing the php version. My website is in php7.4 and my new installation is in php8.2, so some plugins or themes were not compatible.

    Thread Starter deug7

    (@deug7)

    This part of the file class-wp-widget-factory.php:

    sed ‘16,65!d’ /var/www/wordpress/wp-includes/class-wp-widget-factory.php [AllowDynamicProperties]

    class WP_Widget_Factory {

    /**
     * Widgets array.
     *
     * @since 2.8.0
     * @var array
     */
    public $widgets = array();
    
    /**
     * PHP5 constructor.
     *
     * @since 4.3.0
     */
    public function __construct() {
        add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 );
    }
    
    /**
     * PHP4 constructor.
     *
     * @since 2.8.0
     * @deprecated 4.3.0 Use __construct() instead.
     *
     * @see WP_Widget_Factory::__construct()
     */
    public function WP_Widget_Factory() {
        _deprecated_constructor( 'WP_Widget_Factory', '4.3.0' );
        self::__construct();
    }
    
    /**
     * Registers a widget subclass.
     *
     * @since 2.8.0
     * @since 4.6.0 Updated the $widget parameter to also accept a WP_Widget instance object
     *              instead of simply a WP_Widget subclass name.
     *
     * @param string|WP_Widget $widget Either the name of a WP_Widget subclass or an instance of a WP_Widget subclass.
     */
    public function register( $widget ) {
        if ( $widget instanceof WP_Widget ) {
            $this->widgets[ spl_object_hash( $widget ) ] = $widget;
        } else {
            $this->widgets[ $widget ] = new $widget();
        }
    }
Viewing 2 replies - 1 through 2 (of 2 total)