Support » Fixing WordPress » OOP in wordpress plugins – avoid multiple instances???

  • Hi,

    I’m trying to add some OOP with php5 to my wordpress plugin..

    so i have my class

    class Test {
    function __construct()
    {
    log("constructed");
    }
    }
    
    $instance = new Test();

    now when i test it in wordpress.. it always get 2 instances.. because my log shows “constructed” twice!

    I tried avoiding it by an isset($instance) … but that didn’t work..

    How can I avoid this, any help???

    Thanks in advance!!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘OOP in wordpress plugins – avoid multiple instances???’ is closed to new replies.