Ok I'm running my wordpress in debug mode. I'm getting lot of notices.

This is my code.

//allows the theme to get info from the theme options page
global $options;
foreach ($options as $value) {
    if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; }
    else { $$value['id'] = get_option( $value['id'] ); }

This is what i'm seeing.

Notice: Undefined index: id in functions\get-options.php on line 5

Notice: Undefined index: std in functions\get-options.php on line 5

These notices repeated around 20 times. Whats wrong in my code?. Can anyone help me to fix those errors. Thanks.


1 Answer 1


First: Write false === get_option( 'whatever' ); - see Coding Standards.

Second: Why do you have a variable-variable in there? $$value['id'] = $value['std'];.

  • Hey thanks bro, Well i didn't code that theme. I'm just using that theme. Can you look in to this code? You may get some ideas why it coded in that way. Thanks Aug 15, 2011 at 19:07
  • My IDE says, there are no errors or typos. Anyway: What does this have to do with the code shown above or my Q? It's a simple mulitdimensional array.
    – kaiser
    Aug 15, 2011 at 20:23
  • No, I gave you this code because @Bainternet said that there is a bug in the code that sets $options. This is the code that sets $options Aug 15, 2011 at 22:49
  • Please avoid linking code more than once. This only creates confusion. Always update your Q with relevant info when something changes. Further: I checked the code (you linked) with my IDE (Eclipse) and found no errors, so your problem is not in there. Also: You didn't mention from where exactly your above code is. Is thist the code from get-option.php?, or what else? Go back and update the Q and be as specific and detailed as possible. Currently it's a chaos and fishing in the dark.
    – kaiser
    Aug 15, 2011 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.