wordpress - PHP autoloader - $classname includes the entire folder path and not just the class name itself? -


i following wordpress's naming convention class my_class should reside in file named class-my-class.php. used this autoloader wordpress, written rarst. if print out $class_name variable, see prefix class appended folder name , not class file. had same issue other autoloader used earlier. can little bit of string manipulation , want want know exact issue.

what wrong?

i had @ autoloader linked to, should on line 21 :

$class_path = $this->dir . '/class-' . strtolower( str_replace( '_', '-', basename( $class_name ) ) ) . '.php';

basename takes file part + file extension of path.

you need check autoloader file is, because $this->dir set dir, directory autoloader file is.


Comments