Exopite-Simple-Options-Framework icon indicating copy to clipboard operation
Exopite-Simple-Options-Framework copied to clipboard

Do not call default settings

Open mohammadr3z opened this issue 4 years ago • 2 comments

When activating the plugin in WordPress, the default values are not called and the save settings button must be clicked. Is there a way to call the default values?

mohammadr3z avatar Nov 25 '20 10:11 mohammadr3z

You could save the default options on plugin activation.

(https://developer.wordpress.org/reference/functions/get_option/) You can also use get_option( string $option, mixed $default = false ), but -I think- only if you save the options as "simple".

I would go with the plugin activation.

JoeSz avatar Nov 27 '20 16:11 JoeSz

Hey @JoeSz any chance we can get a little documentation or advice on how to save these defaults on plugin activation?

For example, in the wp plugin boilerplate, we have a function that runs on plugin activation, but I don't understand what/which hooks I can use, or how to store the defaults so that they're available before the plugin throws the warnings/errors.

omgwtfwow avatar Apr 20 '21 07:04 omgwtfwow