settings_fields()输出一个设置项目的HTML信息

目录

描述

Output nonce, action, and option_page fields for a settings page. Please note that this function must be called inside of the form tag for the options page.

settings_fields() 描述

用法

<?php settings_fields$option_group ?>

settings_fields() 用法

参数

$option_group

(string) (必填) A settings group name. This should match the group name used in register_setting().

默认值: None

settings_fields() 参数

返回值

(void) 

This function does not return a value.

settings_fields() 返回值

示例

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
<?php
	echo '<form method="post" action="options.php">';
	settings_fields( 'my-plugin-settings-group' );
	
?>

settings_fields() 示例

历史

  • 添加于 版本: 2.7.0

settings_fields() 历史

源文件

settings_fields() 函数的代码位于 wp-admin/includes/plugin.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Output nonce, action, and option_page fields for a settings page.
 *
 * @since 2.7.0
 *
 * @param string $option_group A settings group name. This should match the group name used in register_setting().
 */
function settings_fields($option_group) {
	echo "";
	echo '';
	wp_nonce_field("$option_group-options");
}

settings_fields() 源文件

相关