^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数get_site_option()用法示例

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

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


描述


参数

$option

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

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

$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 );
}

更新日志

Version 描述
4.4.0 Modified into wrapper for get_network_option()
2.8.0 Introduced.

相关函数

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


  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'
    
    

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈