WordPress:Function Reference/add option
来自站长百科
Description
描述
A safe way of adding a named option/value pair to the options database table. It does nothing if the option already exists. The data is escaped with %%%$wpdb->escape%%% before the INSERT statement.
安全地将指定的选项/和选项值添加到选项数据库表格中。如果选项已经存在,不执行任何操作。插入声明之前,The data is escaped with %%%$wpdb->escape%%%。
Usage for wp 2.3.X or newer
wp 2.3.X 或者更新版本的用法
In the lasts versions of wordpress (2.3.X) the parameter $description is deprecated and remove the values from the wp_options table. The usage its the same but the seccond parameter its unused.
在最新的WordPress版本(2.3X),参数$description已经取消了,而且wp_options表格中的参数值也取消了。 用法是相同的但是第二个参数没有得到使用。
See bellow for older version of this reference
看看下面关于这个参考的旧版本
<?php add_option($name, $value = '', $deprecated = '', $autoload = 'yes'); ?>
<?php add_option($name, $value = '', $deprecated = '', $autoload = 'yes'); ?>
Example for wp 2.3.X or newer
wp 2.3.X 或者更新版本的例子
<?php add_option("myhack_extraction_length", '255', '', 'yes'); ?>
<?php add_option("myhack_extraction_length", '255', '', 'yes'); ?>
Parameters for wp 2.3.X or newer
来自 wp 2.3.X或者更新版本的参数
Usage before $description deprecated
$description取消之前的用法
In the last versions of wordpress (2.3.X) the parameter $description is deprecated and remove the values from the wp_options table. The usage its the same but the seccond parameter its unused. WP 2.3.X or newer <?php add_option($name, $value = '', $deprecated = '', $autoload = 'yes'); ?> <pre> 在wordpress最新的版本I (2.3.X) 参数$description 已经被取消,而且从the wp_options 表格中取消了参数值。 用法是相同的但是没有使用第二个参数。 WP 2.3.X 或者更新的版本 <?php add_option($name, $value = '', $deprecated = '', $autoload = 'yes'); ?> <?php add_option($name, $value = '', $description = '', $autoload = 'yes'); ?>
<?php add_option($name, $value = , $description = , $autoload = 'yes'); ?>
Example
例子
<?php add_option("myhack_extraction_length", '255', 'Max length of extracted text in characters.', 'yes'); ?>
<?php add_option("myhack_extraction_length", '255', '字符中提取的文章的最长长度。', 'yes'); ?>