Skip to content

Singleton pattern no more working with php 8.1 #56

Description

@jigar2002

Hello after updating PHP 8.1 we are fetching issues like not showing more custom taxonomy or CPTs because of the Singleton pattern no more working with PHP 8.1 so below is the solution for the same.

public static function instance() {

Replace this with below

public static function instance() {
static $instance=[];
if (!isset($instance[static::class])) {
$instance[static::class] = new static();
}
return $instance[static::class];
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions