【发布时间】:2011-05-06 20:54:00
【问题描述】:
我正在使用这个网站http://wpbits.wordpress.com/2007/08/15/adding-options-to-wordpress-plugins/,to 帮助我锻炼如何制作一个保存选项的插件。 这是我的代码,但它似乎不起作用。谁能指出我正确的方向:
<?php
/*
* Plugin Name: test
* Plugin URI: www.test.com
* Version: 1.0
* Author: J Davies
* Author URI: test.com
* Description: Random Test
*/
function say_test(){
$greeting = get_option('test_greeting');
print "Say ".$greeting;
}
function set_test_options(){
add_option('test_greeting','test','test');
}
function unset_test_options(){
delete_option('test_greeting');
}
register_activation_hook(__FILE__,'set_test_options');
register_deactivation_hook(__FILE__,'unset_test_options');
?>
【问题讨论】: