How do I extend one plugin I’m writing with another I’m writing using classes?

If the classes are not in the same file, you’ll need to require it into the child class ( myCustomClass ). Are you doing that?

Example :

//get the base class
if(!class_exists('MyParentClass')) {
    require_once plugin_dir_path( __FILE__ ) . '/_inc/MyParentClass.php';
}

/**
 * Class Definition
 */
class MyChildClass extends MyParentClass{

    // class definition

}

Leave a Comment