I have a set of plugins that do different things. I'm wanting to write a plugin with a class I can extend in each of my custom plugins to meet a common goal. In my "socket" plugin I have something like this

class socketPlugin {
        function __construct($extendedClass){
    global $wpdb;
    $tablename = $wpdb->prefix."tableName";

    $classCount = $wpdb->get_var(
        "SELECT COUNT(id) FROM $tablename WHERE extendedClass='$extendedClass'"

    if($classCount && $classCount > 0){
            'extendedClass' => $extendedClass


I then want to do something like this:

class myCustomClass extends socketPlugin {


And pass a variable into the constructor. Right now, if I do the above I get the PHP "white screen of death".

Any ideas why I'm getting a white screen? How can I propperly extend the class of the socket plugin?

  • 1
    Something like Including file or library from other plugin?
    – fuxia
    Apr 22, 2014 at 18:50
  • apparently the problem is my other plugin can't see the socket class. Not following how to use do_action and add_action to accomplish this...
    – dcp3450
    Apr 22, 2014 at 19:09

1 Answer 1


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


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.