[wp-trac] [WordPress Trac] #38176: Add 'default' to register_setting
WordPress Trac
noreply at wordpress.org
Tue Sep 27 19:31:00 UTC 2016
#38176: Add 'default' to register_setting
--------------------------------+------------------------------
Reporter: rmccue | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------------+------------------------------
Comment (by rmccue):
As an example of how this works:
{{{#!php
<?php
// Register the setting.
register_setting( 'rmccue', 'rmccue_some_setting', [
'default' => 'yolo',
]);
var_dump( get_option( 'rmccue_some_setting' ) );
// => 'yolo'
var_dump( get_option( 'rmccue_some_setting', false ) );
// => false
var_dump( get_option( 'rmccue_some_setting', null ) );
// => null
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38176#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list