Fix "undefined index" after save theme setting
-
While Debug ON, I constantly goy “Undefined index” PHP notice message.
The theme modification takes effect – BUT the errors diplayed
were annoying.Unfortunately the fix requires simple code change in admin/sanitize.php
The change is a better programming practice: to verify that index exists prior to using it. The fix is as follows:if (array_key_exists('tempera_columnimg1', $input)) $input['tempera_columnimg1'] = wp_kses_data($input['tempera_columnimg1']);The above is an example only.
You will have to modify dozens of lines by adding the following line:
if (array_key_exists('tempera_relevant-index', $input))
prior to each assignment.Home exercise: Consider using a loop over all indices that access only defined indices. Should be ~7 lines only…
The topic ‘Fix "undefined index" after save theme setting’ is closed to new replies.
