This code is located in my plugin class file. I can get the echo statement in the constructor to show up just fine, but for some reason it just won't call the method. Any ideas?
public function __construct($plugin_name, $version)
{
$this->plugin_name = $plugin_name;
$this->version = $version;
echo "here";
register_activation_hook(__FILE__, array($this, 'create_plugin_database_table' ));
}
public function create_plugin_database_table()
{
echo "here";
global $wpdb;
$table_name = $wpdb->prefix . 'sandbox';
$sql = "CREATE TABLE $table_name (
id mediumint(9) unsigned NOT NULL AUTO_INCREMENT
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire