Support

Account

Home Forums Backend Issues (wp-admin) ACF Field using WYSIWYG Editor Reply To: ACF Field using WYSIWYG Editor

  • I tried using the field key but I must have something incorrect. I tried name= type= and key= without success. I also tried all combos using the field key for the actual textarea field and the flex field key. The textarea field name is definitely ‘ingredients’.

    
    add_filter ('acf/format_value/name=field_5bc60b64aa3bd', 'format_ingredients', 20, 3);
    function format_ingredients($value, $post_id, $field) {
      if (!$value) {
        return $value;
      }
      $array = acf_decode_choices($value);
      if (!is_array($array) || empty($array)) {
        return $value;
      }
      ob_start();
      ?>
        <ul>
          <?php 
            foreach ($array as $line) {
              ?><li><?php echo $line; ?></li><?php 
            }
          ?>
        </ul>
      <?php 
      $value = ob_get_clean();
      return $value;
    }