0

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 );
    }
}
0

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 );
}
|improve this answer|||||

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.