首页 WordPress函数大全 get_option()

get_option()

2020-05-01 / 6443阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_option( string $option, mixed $default = false )

Retrieves an option value based>

Contents

  • Description
    • Parameters
    • Return
    • Source
    • Changelog
  • More Information
  • Related
    • Uses
    • Used By
  • User Contributed Notes

描述

If the option does not exist or does not have a value, then the return value will be false. This is useful to check whether you need to install an option and is commonly used during installation of plugin options and to test whether upgrading is required.

If the option was serialized then it will be unserialized when it is returned.

Any scalar values will be returned as strings. You may coerce the return type of a given option by registering an ‘option_$option’ filter callback.

参数

$option

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

$default

(mixed)
(Optional)
Default value to return if the option does not exist.

Default value: false

返回

(mixed) Value set for the option.

大家谈论
    我的见解