我在选项框架中生成以下通知。php。
注意:未定义索引:在选项框架中。php
我认为这与卫生处理有关,但不知道如何解决这个问题。
我在选项中定义了以下数组。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);
选项框架。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 );
}
}
最合适的回答,由SO网友:birgire 整理而成
很可能您有一个未定义的数组索引。您可以检查数组索引是否存在isset()
像这样:
if(isset($some_array[$some_index])){
}
因此,请检查
options-framework.php
文件
您可以尝试,例如:
if ( isset($option[\'type\']) && isset($input[$id]) && has_filter( \'of_sanitize_\' . $option[\'type\'] ) ) {
$clean[$id] = apply_filters( \'of_sanitize_\' . $option[\'type\'], $input[$id], $option );
}