$wpdb Not Instance of wpdb
-
Some silly plugins actually check or enforce that
$wpdb
is an instance of thewpdb
class, which does kind of make sense if you prefer strict code. But in the case of WP DB Driver,$wpdb
is set to an instance of thewpdb_drivers
class, so this test fails.These checks could be in the form of:
function my_func(wpdb $wpdb) { ... }
Or just:
if ($wpdb instanceof wpdb) { ... }
To circumvent this, wouldn’t it be a good idea to extend the
wpdb_drivers
class from thewpdb
class? This would solve any issues like this with other plugins, and also make it more semantic.What do you think?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘$wpdb Not Instance of wpdb’ is closed to new replies.