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;
endif;
}
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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.