Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not call default settings #32

Open
mohammadr3z opened this issue Nov 25, 2020 · 2 comments
Open

Do not call default settings #32

mohammadr3z opened this issue Nov 25, 2020 · 2 comments

Comments

@mohammadr3z
Copy link

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?

@JoeSz
Copy link
Owner

JoeSz commented Nov 27, 2020

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 JoeSz closed this as completed Dec 9, 2020
@omgwtfwow
Copy link

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.

@JoeSz JoeSz reopened this Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants