返回介绍

get_site_option()

发布于 2017-09-11 00:12:36 字数 7234 浏览 981 评论 0 收藏 0

get_site_option( string $option,  mixed $default = false,  bool $deprecated = true )

Retrieve an option value for the current network based on name of option.


description


参数

$option

(string) (Required) Name of option to retrieve. Expected to not be SQL-escaped.

$default

(mixed) (Optional) value to return if option doesn't exist.

Default value: false

$deprecated

(bool) (Optional) Whether to use cache. Multisite only. Always set to true.

Default value: true


返回值

(mixed) Value set for the option.


源代码

File: wp-includes/option.php

function get_site_option( $option, $default = false, $deprecated = true ) {
	return get_network_option( null, $option, $default );
}

更新日志

Versiondescription
4.4.0Modified into wrapper for get_network_option()
2.8.0Introduced.

相关函数

Uses

  • wp-includes/option.php: get_network_option()

Used By

  • wp-includes/class-wp-theme.php: WP_Theme::network_enable_theme()
  • wp-includes/class-wp-theme.php: WP_Theme::network_disable_theme()
  • wp-includes/functions.php: _wp_upload_dir()
  • wp-signup.php: show_blog_form()
  • wp-admin/includes/network.php: network_step2()
  • wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::after_core_update()
  • wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::send_email()
  • wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::send_debug_email()
  • wp-admin/includes/class-wp-automatic-updater.php: WP_Automatic_Updater::send_core_update_notification_email()
  • wp-admin/includes/class-core-upgrader.php: Core_Upgrader::should_update_to_version()
  • wp-admin/includes/class-wp-plugins-list-table.php: WP_Plugins_List_Table::prepare_items()
  • wp-admin/includes/ms.php: site_admin_notice()
  • wp-includes/capabilities.php: grant_super_admin()
  • wp-includes/capabilities.php: revoke_super_admin()
  • wp-admin/includes/ms.php: update_option_new_admin_email()
  • wp-admin/includes/ms.php: send_confirmation_on_profile_email()
  • wp-admin/includes/ms.php: upload_is_user_over_quota()
  • wp-admin/includes/ms.php: check_upload_size()
  • wp-admin/includes/ms.php: wpmu_delete_blog()
  • wp-admin/includes/schema.php: populate_network()
  • wp-admin/includes/update.php: maintenance_nag()
  • wp-admin/includes/update.php: get_core_updates()
  • wp-admin/includes/update.php: dismiss_core_update()
  • wp-admin/includes/update.php: undismiss_core_update()
  • wp-admin/includes/dashboard.php: wp_dashboard_quota()
  • wp-admin/includes/upgrade.php: upgrade_network()
  • wp-admin/includes/upgrade.php: wp_install_defaults()
  • wp-admin/includes/plugin.php: is_plugin_active_for_network()
  • wp-admin/includes/plugin.php: activate_plugin()
  • wp-admin/includes/plugin.php: deactivate_plugins()
  • wp-admin/includes/plugin.php: validate_active_plugins()
  • wp-admin/includes/class-wp-themes-list-table.php: WP_Themes_List_Table::no_items()
  • wp-includes/capabilities.php: get_super_admins()
  • wp-includes/capabilities.php: map_meta_cap()
  • wp-includes/l10n.php: get_locale()
  • wp-includes/pluggable.php: wp_salt()
  • wp-includes/class-wp-theme.php: WP_Theme::get_allowed_on_network()
  • wp-includes/functions.php: global_terms_enabled()
  • wp-includes/default-constants.php: wp_cookie_constants()
  • wp-includes/update.php: wp_version_check()
  • wp-includes/option.php: set_site_transient()
  • wp-includes/option.php: get_site_transient()
  • wp-includes/user.php: wp_get_user_contact_methods()
  • wp-includes/ms-functions.php: get_space_allowed()
  • wp-includes/ms-functions.php: get_upload_space_available()
  • wp-includes/ms-functions.php: is_upload_space_available()
  • wp-includes/ms-functions.php: upload_size_limit_filter()
  • wp-includes/ms-functions.php: users_can_register_signup_filter()
  • wp-includes/ms-functions.php: wpmu_welcome_user_notification()
  • wp-includes/ms-functions.php: check_upload_mimes()
  • wp-includes/ms-functions.php: upload_is_file_too_big()
  • wp-includes/ms-functions.php: wpmu_create_blog()
  • wp-includes/ms-functions.php: newblog_notify_siteadmin()
  • wp-includes/ms-functions.php: newuser_notify_siteadmin()
  • wp-includes/ms-functions.php: install_blog()
  • wp-includes/ms-functions.php: wpmu_welcome_notification()
  • wp-includes/ms-functions.php: is_email_address_unsafe()
  • wp-includes/ms-functions.php: wpmu_validate_user_signup()
  • wp-includes/ms-functions.php: wpmu_validate_blog_signup()
  • wp-includes/ms-functions.php: wpmu_signup_blog_notification()
  • wp-includes/ms-functions.php: wpmu_signup_user_notification()
  • wp-includes/ms-load.php: wp_get_active_network_plugins()
  • wp-includes/ms-load.php: ms_site_check()
  • wp-includes/ms-deprecated.php: get_dashboard_blog()
  • wp-includes/ms-default-constants.php: ms_upload_constants()
  • wp-includes/script-loader.php: script_concat_settings()
  • Show 61 more used by Hide more used by

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note Contributed by Codex

    Default Usage

    
    echo get_site_option( 'siteurl' );
    
    
  2. Passing a Default Value

    
    $value = get_site_option( 'i_dont_exist' );
    
    // $value == false
    
    $value = get_site_option( 'i_dont_exist', 'blah' );
    
    // $value == 'blah'
    
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文