Set a Default Value for an Option?

There isn’t anything clever that I can see. I’ve used two approaches in the past:

1 – Your plugin’s activation code could save all your default options, so that you never need to use the second parameter to get_option Really, this equates to your…

default value for setting that have not yet been saved.

2 – You could define a set of constants for the default values, and then use those constants for the second parameter to get_option

Leave a Comment