I'm working on a Wordpress plugin on my localhost using MAMP.
In my main plugin file, I have these lines in the beginning:
define ('MY_PLUGIN_PATH', plugin_dir_path(__FILE__));
// Include admin.php if admin user
if ( is_admin() ) {
require_once( MY_PLUGIN_PATH . 'admin/admin.php');
}
In my admin.php I have these lines for setting up database upon activation:
// Runs when plugin is activated
register_activation_hook(__FILE__,'clsc_install');
// Create new database fields
function clsc_install() {
$clsc_options = array(
'Login_link' => 'test1',
'Login_string' => 'test2',
'Login_class' => 'test3',
'Logout_link' => 'test4',
'Logout_string' => 'test5',
'Logout_class' => 'test6',
'Account_link' => 'test7',
'Account_string' => 'test8',
'Account_class' => 'test9'
);
add_option('clsc_options', $clsc_options, '', 'yes');
}
I don't see any options made to the database upon plugin activation.
What am I missing?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire