2015-11-04 81 views

回答

0

正如我读通每一项的描述,这是我对吧:

https://codex.wordpress.org/Function_Reference/get_option

https://codex.wordpress.org/Function_Reference/get_user_option

get_option似乎是一次设置的全局选项,所有用户总是会得到相同的值。它可能会由管理员设置,用户无法自行更改设置。

get_user_option是一个用户特定的值,所以如果一个用户设置它,它将不会为其他用户设置。每个用户将为它设置自己的唯一值。

因此,很可能您希望使用get_option和update_option来实现影响所有用户的一般设置,并且每个用户都不能为自己设置个人身份。

0

Wp的get_user_options https://codex.wordpress.org/Function_Reference/get_user_option

Wp的update_user_option https://codex.wordpress.org/Function_Reference/update_user_option

我知道的wordpress的文件是很难理解,如果你也面临同样的问题,让我知道我会解释用我自己的话。 :)

+0

我明白如何为你get_user_options和update_user_options。我的问题是为什么我会选择使用get_user_option和get_option。 Wordpress并没有解释两者之间的区别,以及我应该什么时候选择一个。 https://codex.wordpress.org/Function_Reference/get_option https://codex.wordpress.org/Function_Reference/get_user_option – jsherk

0

get_option是使用挂钩可以被任何用户使用像

<h1><?php echo get_option('blogname'); ?></h1>

get_user_option的东西被用来将所有像用户可用的编缉选项。

对不起,我是新来这个网站我不能够添加PHP代码:'(

我知道我的例子是不符合逻辑的bcuz只有管理员可以访问该面板:d