Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

This is my code.

<?php
//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.

share|improve this question
    
post the code that sets $options –  Bainternet Aug 14 '11 at 8:05
    
@Bainternet Here is my $options code –  Giri Aug 14 '11 at 14:19
1  
Oh dear! get-options.php has an std! –  Drew Gourley Aug 15 '11 at 18:37

1 Answer 1

up vote 1 down vote accepted

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

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

share|improve this answer
    
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 –  Giri Aug 15 '11 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 '11 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 –  Giri Aug 15 '11 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 '11 at 23:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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