Opened 18 years ago
Closed 18 years ago
#7637 closed enhancement (fixed)
Pass default value to get_option()
| Reported by: | azaozz | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.7 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Allows a default value to be passed through get_option() and returned if the option is not set. So all of these would work well:
$myarray = get_option( 'myarray', array('q', 'w', 'e') );
$myvar = get_option( 'myvar', '<p>My var is not set</p>' );
$mybool = get_option( 'mybool', true );
The second arg is optional and is fully backwards-compatible, get_option() will return false when the option is not set and default value is not specified.
Attachments (1)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
(In [8770]) Pass default value to get_option(), fixes #7637