[wp-trac] [WordPress Trac] #7637: Pass default value to get_option()
WordPress Trac
wp-trac at lists.automattic.com
Fri Aug 29 07:22:59 GMT 2008
#7637: Pass default value to get_option()
-------------------------+--------------------------------------------------
Reporter: azaozz | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version:
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
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.
--
Ticket URL: <http://trac.wordpress.org/ticket/7637>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list