由于某些原因,我无法保存表单中的数据:
add_action( \'admin_menu\', \'example_menu_settings\' );
/** Step 1. */
function example_menu_settings() {
add_options_page( \'example Plugin Options\', \'example\', \'manage_options\', \'example-settings\', \'example_plugin_options\' );
add_action( \'admin_init\', \'register_example_settings\' );
}
/** Step 3. */
function example_plugin_options() {
if ( !current_user_can( \'manage_options\' ) ) {
wp_die( __( \'You do not have sufficient permissions to access this page.\' ) );
}
$client_id = get_option(\'example_client_id\', \'\');
$secret = get_option(\'example_secret\', \'\');
echo \'<div class="wrap">
<h2>example Plugin Settings</h2>
<br><br>
<form method="post" action="options.php">\';
settings_fields( \'example-settings-group\' );
do_settings_sections( \'example-settings-group\' );
echo \'<input type="hidden" name="option_page" value="general"><input type="hidden" name="action" value="update"><input type="hidden" id="_wpnonce" name="_wpnonce" value="103f63adef"><input type="hidden" name="_wp_http_referer" value="/example-Blog/wp-admin/options-general.php">
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row"><label for="example_client_id">Client ID</label></th>
<td><input name="example_client_id" type="text" id="example_client_id" value="\' . $client_id . \'" class="regular-text">
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="example_secret">Secret</label></th>
<td><input name="example_secret" type="text" id="example_secret" value="\' . $secret . \'" class="regular-text">
</td>
</tr>
<tr><td colspan="2" class="description" style="padding: 25px 0 10px 0;">Your keys is found inside your <a href="https://example.com/user" target="_blank">example account settings</a>.</td>
</tr>
</tbody>
</table>
<br>
<button id="example-test-connection" class="button">Test connection</button>\';
echo submit_button();
echo \'</form>
</div>\';
}
function register_example_settings() { // whitelist options
register_setting( \'example-settings-group\', \'example_client_id\' );
register_setting( \'example-settings-group\', \'example_secret\' );
}
以下是我得到的错误:
Are you sure you want to do this?
Please try again.
这是/wp admin/选项。php页面。
我做错了什么?