I’m creating a simple settings page by following these instructions.

Since this is a custom plugin, I’d like one of my settings to start with a predefined value (that can later be changed). What is the recommended way to set a default value for a setting added with add_settings_field?

1
1

if ( get_option( 'my_setting' ) === false ) // Nothing yet saved
    update_option( 'my_setting', 'default_stuff' );

Leave a Reply

Your email address will not be published. Required fields are marked *