sorry… another ‘register_activation_hook’ problem
-
OK. I’m going crazy here. I’ve found a lot of threads devoted to the register_activation_hook function, but nothing with the problem I’m having.
I’ve been trying to create another table during installation of a custom plugin, but nothing was working. I put WP into ‘debug’ mode, but it doesn’t throw any errors other than
“Plugin could not be activated because it triggered a fatal error.”
My code looked something like
$wpdb->location_tracking = "{$wpdb->prefix}location_tracker"; function location_tracker_activate() { global $wpdb; $create_table_sql = " CREATE TABLE {$wpdb->location_tracking} ( id int AUTO_INCREMENT, lat float(10,6), lng float(10,6), primary key (id) ) "; require_once(ABSPATH . 'wp-admin/includes/install.php'); maybe_create_table($wpdb->location_tracking, $create_table_sql); } register_activation_hook(__FILE__, 'location_tracker_activate');So, I’m now just trying to kill the process during my installation, but I just get the same result. Nothing ‘dies’, I just get
“Plugin could not be activated because it triggered a fatal error.”
function location_tracker_activate() { die('WTF?'); } register_activation_hook(__FILE__, 'location_tracker_activate');Another strange thing is if I register a function that doesn’t exist, I have no errors thrown at all.
register_activation_hook(__FILE__, 'mungy_mungy_mungy');I’m obviously doing something stupid… but what?
(Oh, and everything’s being declared in the main plugin file “wp-content/plugins/location_tracker/location_tracker.php”)
The topic ‘sorry… another ‘register_activation_hook’ problem’ is closed to new replies.