I’m trying to pull content from a WYSIWYG field <textarea> in the edit screen and run it through the acf_the_content filter so that it’s presentable as a preview. I need to get the <p>
tags and shortcodes processed.
...
input = field.find('.acf-input');
if(field.data('type') == 'wysiwyg'){
holder = input.find('.acf-editor-wrap');
temp = holder.find('textarea').val();
data = acf.applyFilters('acf_the_content', temp);
}
input.append('<div class="siep-protected">' + data + '</div>');
I’m mostly there, but for some reason, none of the filters attached to acf_the_content
are being applied. Does this only work via PHP?
https://www.advancedcustomfields.com/resources/javascript-api/
Yes, these filters only work in PHP. The same for all of “the_content” filters in WP. These are basically the same hooks with only slight variation for ACF.