当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_set_all_user_settings函数代码示例

本文整理汇总了PHP中wp_set_all_user_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_set_all_user_settings函数的具体用法?PHP wp_set_all_user_settings怎么用?PHP wp_set_all_user_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_set_all_user_settings函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete_user_setting

/**
 * Delete user interface settings.
 *
 * Deleting settings would reset them to the defaults.
 * This function has to be used before any output has started as it calls setcookie().
 *
 * @package WordPress
 * @subpackage Option
 * @since 2.7.0
 *
 * @param mixed $names The name or array of names of the setting to be deleted.
 * @return bool true if deleted successfully/false if not.
 */
function delete_user_setting($names)
{
    if (headers_sent()) {
        return false;
    }
    $all_user_settings = get_all_user_settings();
    $names = (array) $names;
    $deleted = false;
    foreach ($names as $name) {
        if (isset($all_user_settings[$name])) {
            unset($all_user_settings[$name]);
            $deleted = true;
        }
    }
    if ($deleted) {
        return wp_set_all_user_settings($all_user_settings);
    }
    return false;
}
开发者ID:palimadra,项目名称:bubblegraphics-wpsite,代码行数:32,代码来源:option.php

示例2: set_user_setting

 function set_user_setting($name, $value)
 {
     $all_user_settings = get_all_user_settings();
     $all_user_settings[$name] = $value;
     return wp_set_all_user_settings($all_user_settings);
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:6,代码来源:userSettings.php


注:本文中的wp_set_all_user_settings函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。