0
我是WordPress新手,我已經構建了一個插件,只需在管理菜單上保存設置即可。爲什麼我的設置不能保存在WordPress的管理員?
但是,當我點擊保存按鈕,它只是帶我到options.php頁面,並沒有做任何事情。我已經查看過我的代碼幾次,我似乎無法找到爲什麼它不保存,並只停留在options.php頁面。
任何幫助將非常感謝!由於
function fflOptionsMenuLink(){
add_options_page("Facebook Footer Link Options", "Facebook Footer Link","manage_options","ffl-options","fflOptionsContent");
}
function fflOptionsContent(){
$opt = get_option("ffl_settings");
$output = "<div class='wrap'>
<h2>Facebook footer link settings </h2>
<form method='post' action='options.php' id='ffl_settings_group'>";
settings_fields('ffl_settings_group');
$output .= "<table class='form-table'>
<tbody>
<tr>
<th scope='row'><label for='ffl_settings[enable]'>Enable</label> </th>
<td><input name='ffl_settings[enable]' type='checkbox' id='ffl_settings[enable]' value='1' ></td>
</tr>
<tr>
<th scope='row'><label for='ffl_settings[facebook_url]'>Facebook Profile </label> </th>
<td><input name='ffl_settings[facebook_url]' type='text' id='ffl_settings[facebook_url]' value='{$opt["ffl_settings"]}' class='regular-text' ></td>
</tr>
<tr>
<th scope='row'><label for='ffl_settings[link_color]'>Enter color or hex value</label> </th>
<td><input name='ffl_settings[link_color]' type='text' id='ffl_settings[link_color]' value='{$opt["link_color"]}' class='regular-text' ></td>
</tr>
<tr>
<th scope='row'><label for='ffl_settings[show_in_feed]'>Show in feed</label> </th>
<td><input name='ffl_settings[show_in_feed]' type='checkbox' id='ffl_settings[show_in_feed]' value='1' ></td>
</tr>
</tbody>
</table>
<p class='submit'><input type='submit' name='submit' id='submit' class='button button-primary' value='Submit'> </p>
";
$output .= "</form>";
$output.="</div>";
echo $output;
}
add_action("admin_menu","fflOptionsMenuLink");
//Register Settings
function fflRegisterSetting(){
register_setting("ffl_settings_group","ffl_settings");
}
add_action("admin_init","ffl_register_setting");
嗨感謝您的答覆。我複製並粘貼了你的代碼,但它仍然沒有工作 – json2021
嗯...你會得到什麼? – shramee
Ohh ...更新了我的回答...讓我知道如果它現在:) – shramee