mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Added Alex Stapleton's add_option() code.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9b3163412c
commit
2c3e14a0ea
@ -337,10 +337,23 @@ function update_option($option_name, $newvalue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function add_option() {
|
||||
|
||||
// thx Alex Stapleton, http://alex.vort-x.net/blog/
|
||||
function add_option($name, $value='') {
|
||||
// Adds an option if it doesn't already exist
|
||||
global $wpdb, $tableoptions;
|
||||
// TODO
|
||||
if(!get_settings($name)) {
|
||||
$name = $wpdb->escape($name);
|
||||
$value = $wpdb->escape($value);
|
||||
$wpdb->query("INSERT INTO $tableoptions (option_name, option_value) VALUES ('$name', '$value')");
|
||||
|
||||
global $use_cache;
|
||||
if($wpdb->insert_id && $use_cache) {
|
||||
global $cache_settings;
|
||||
$cache_settings->{$name} = $value;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function get_postdata($postid) {
|
||||
|
Loading…
Reference in New Issue
Block a user