My plugin i have many options. I use get_option and store it as an array so its easier to use.
function woomps_get_options() {
$options = array(
'sub01' => get_option(woomps_sub01),
'sub02' => get_option(woomps_sub02),
);
return $options;
}
This produces this notice for each line:
[TIME] PHP Notice: Use of undefined constant woomps_sub01 - assumed 'woomps_sub01' in "DOMAIN"settingsoptions.php on line 9
I dont understand why i should define woomps_sub01 first or how i should define it. But my question is rather: Why is this not a correct way to get a WP option and what is the better way?
PHP is simply telling that you’re passing to the function a undefined constant but probably you meant
'woomps_sub01'
as a string.Just put quotes like this
get_option('woomps_sub01')
and the notice will go away.