get_site_option()获取wp_option表中的选项/值对(多站点)

目录

描述

Retrieve a network option value based on option name.

This function is almost identical to get_option(), except that in multisite, it returns the network-wide option. For non-multisite installs, it uses get_option.

get_site_option() 描述

用法

<?php get_site_option$option$default $use_cache ?>

get_site_option() 用法

参数

$option

(string) (必填) The name of the option to retrieve. Expected to not be SQL-escaped .

默认值: None

$default

(mixed) (可选) A value to return if the option doesn't exist.

默认值: false

$use_cache

(boolean) (可选) Whether to use the cache. This has no effect on non-multisite installs.

默认值: true

get_site_option() 参数

返回值

(mixed) 

Current value for the specified option. If the specified option does not exist, returns boolean FALSE.

get_site_option() 返回值

示例

Default Usage

Passing a Default Value

get_site_option() 示例

注意

  • It is easy to get confused about the difference between get_option() and get_site_option(), because multisite used different terms before. Now there are different "sites" on a "network", before there where different "blogs" on a "site". Many functions and variables were introduced before this change, such as this one. Think of this function as "get_network_option()".

get_site_option() 注意

历史

get_site_option() 历史

源文件

get_site_option() 函数的代码位于 wp-includes/option.php.

get_site_option() 源文件

相关