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.

I am generating the following notice in the options-framework.php.

Notice: Undefined index: in options-framework.php

I believe it is something to do with sanitization, but do not know how to resolve this issue.

I have the following arrays defined in options.php

// Pull all the custom taxonomies into an array
$options_password_taxonomies = array();
$taxonomies_password_terms_obj = get_terms('password_gallery_category');
foreach ( $taxonomies_password_terms_obj as $taxonomy) {
    if( isset( $taxonomy->term_id ) ){
        $options_password_taxonomies[$taxonomy->term_id] = $taxonomy->name;
    }
}

 // Select a Category for your Client Area
$options[] = array(
    'name' => __('Password Protected Galleries', 'shutter'),
    'desc' => __('Choose a category for password protected client galleries.', 'shutter'),
    'id' => 'client_area',
    'type' => 'select',
    'options' => $options_password_taxonomies);

options-framework.php

// For a value to be submitted to database it must pass through a sanitization filter
    if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
        $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'],   $input[$id], $option );
    }
}
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Most likely you have an undefined array index. You can check if the array index exists with isset() like this:

if(isset($some_array[$some_index])){

}

So check all your arrays in the options-framework.php file.

You can try for example:

if ( isset($option['type']) && isset($input[$id]) && has_filter( 'of_sanitize_' . $option['type'] ) ) {
        $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'],   $input[$id], $option );
}
share|improve this answer
    
Thank you so much! It worked perfectly! –  Dean McCann Feb 27 '13 at 13:13

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.