嗨,我是wordpress插件开发新手。我对设置api有问题。如果可以的话,请帮忙。
下面是我的问题。
function load_plugin() {
add_settings_section(\'plugin_main\', \'<h1>Ticker Settings</h1>\', \'plugin_section_text\', \'plugin\');
add_settings_field(\'plugin_text_string\', \'Title text\', \'plugin_setting_string\', \'plugin\', \'plugin_main\');
add_settings_field(\'post_title_link\', \'Link\', \'plugin_link_setting\', \'plugin\', \'plugin_main\');
register_setting(\'plugin_options\', \'plugin_options\');
register_setting(\'post_title_link\', \'post_title_link\');
}
function plugin_section_text() {
echo \'<p>Change your post ticker title and give link to.</p>\';
}
function plugin_setting_string() {
echo "<input id=\'plugin_text_string\' name=\'plugin_options\' size=\'40\' type=\'text\' value=\'" . get_option(\'plugin_options\') . "\' />";
}
function plugin_link_setting() {
echo "<input id=\'post_title_link\' name=\'post_title_link\' size=\'40\' type=\'text\' value=\'" . get_option(\'post_title_link\') . "\' />";
}
add_action(\'admin_init\', \'load_plugin\');
function post_ticker_setting() {
?>
<div class="wrap">
<form action="options.php" method="post">
<?php
settings_fields(\'plugin_options\');
settings_fields(\'post_title_link\');
do_settings_sections(\'plugin\');
?>
<input name="Submit" type="submit" value="<?php esc_attr_e(\'Save Changes\'); ?>" />
</form>
</div>
<?php
}
这是代码。我面临的问题是最后一条记录是链接,它正在数据库中更新,但标题文本没有在数据库中更新。
所以请帮我找到解决办法。非常感谢。