php – Array data only saving 1 character legnth… How to make longer length?

Question

Getting into writing my own functions to save some arrays from within wordpress, and I am running into a little problem. The option name and the array titles save fine without problem. The $input or array_section as named below only save 1 character length maximum. The array looks normal/correct in the database and I view the saved 1 character in quotes in the saved array data. Do I need to set the length to allow more characters? What do I add to make the saving length longer?

function myarrayfun($input) {
 $option_name="array_option_name";
 $option_group = get_option('array_option_name');
 $option_group = array('array_title_name' => sanitize_text_field($input['array_section']));
 if (get_option($option_name) !== false) {
  return wp_filter_nohtml_kses(update_option($option_name, $option_group));
 } else {
  $deprecated = null;
  $autoload = 'no';
  return wp_filter_nohtml_kses(add_option($option_name, $new_value, $deprecated, $autoload));
 }
}

0
Angel Hess 4 months 2022-04-19T19:19:47-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse