0

I would like to override this plugin class :

class-config.php

namespace um;

if ( ! defined( 'ABSPATH' ) ) exit;

if ( ! class_exists( 'um\Config' ) ) {


    /**
     * Class Config
     *
     * Class with global variables for UM
     *
     * @package um
     */
    class Config
    {
        //some code here...
    }
    //end class
}

But as you can see, this class uses a namespace, so I can't just write this in my functions.php :

functions.php

class Config
{
    //some new code here...
}

I tried to add namespace um; in functions.php but of course it doesn't work.

Does anybody have an idea ? :)

0

I found it ! :)

I just created another file called class-config-new.php just next to functions.php. I wrote my class in class-config-new.php and added the namespace, and I added a require_once in functions.php to call the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.