Registering an activation hook doesn't seem to work
-
I have the following declared at the top of a php file called myplugin.php:
register_activation_hook(‘myplugin.php’, ‘setup’);
Setup creates some new tables in the database:
function setup() {
global $wpdb;
$table = $wpdb->prefix.”post_votes”;
$wpdb->query(“DROP TABLE IF EXISTS “.$table);$wpdb->query(“CREATE TABLE IF NOT EXISTS
wp_post_votes
(
post_id
int(11) DEFAULT NULL,
blog_id
int(11) DEFAULT NULL,
vote_count
int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;”);$table = $wpdb->prefix.”user_votes”;
$wpdb->query(“DROP TABLE IF EXISTS “.$table);$wpdb->query(“CREATE TABLE IF NOT EXISTS
wp_user_votes
(
user_id
int(11) DEFAULT NULL,
post_id
int(11) DEFAULT NULL,
blog_id
int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;”);
}The tables are never created so it has led me to believe that the setup function is not being called. Any ideas on how to fix?
I’m network activating if that makes a difference…
- The topic ‘Registering an activation hook doesn't seem to work’ is closed to new replies.