wp-includes classes.php

The classes.php file has only one is_a in it. And the class it tests for, WP_Error, has no subclasses in the WordPress Core. But the function it's in, is_wp_error, gets called literally hundreds of times per page load. If you replace is_a with get_class or is_subclass_of in only one file, IMHO, this should be the one file.

function is_wp_error($thing) {
//	if ( is_object($thing) && is_a($thing, 'WP_Error') )
	$class_name = 'WP_Error';
	if ( is_object($thing)
	 && ( ( get_class($thing) == $class_name )
	 || is_subclass_of($thing, $class_name) ) )
		return true;
	return false;
}
Technorati Tags: ,

One Trackback

  1. By the Mittineague Blog -> is_a Conclusion on July 29, 2009 at 6:33 pm

    [...] wp-includes/classes.php [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*