I am trying to add a custom table handler to $wpdb
.
public function __construct() {
$this->register_tables();
}
public function register_tables() {
global $wpdb;
$wpdb->tables[] = 'my_new_tablename';
}
public function testing() {
global $wpdb;
wp_die($wpdb->my_new_tablename);
}
But when running the testing()
method, I realize that $wpdb->my_new_tablename
is not defined.
How may I register my own table name and make it available at $wpdb->my_new_tablename
, just like as if it was a native WP table?