Open mohammadr3z opened 3 years ago
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.
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.
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?