Home Forums ACF PRO REST API wysiwyg returns stripped html Reply To: REST API wysiwyg returns stripped html

  • I’ve had the same problem but fixed it with wpautop(). I had to run the data I got from the REST API through another function anyway and as I knew when to expect a return from a WYSIWYG field, I could return it with wpautop().

    Like so:

    function format_wysiwyg($value, $sType = 'default')
      if ($sType === 'wysiwyg') :
        return wpautop($value);
      else :
        return $Value;

    I called it with format_wysiwyg($Value_from_rest, 'wysiwyg') if I knew it was WYSIWYG and just format_wysiwyg($Value_from_rest) if it wasn’t.

    Not very smart, but it worked for my case.