Search code examples
phpwordpressadvanced-custom-fieldswysiwyg

ACF remove_filter not working for wysiwyg field


Using ACF and have a field that requires use of wysiwyg field.

I'm trying to apply a filter to the content using add_filter('acf_the_content'), but it's not working.

The next thing I tried was to use remove_filter('acf_the_content', 'wpautop') but this does nothing as well.

Any help or point in the right direction would be swell!


Solution

  • Here is a working example of how to use the acf_content filter. I can confirm this is working using Twenty Seventeen theme and placing the filter in the theme's functions.php.

    add_filter('acf_the_content', function($content){ // do some magic to $content // e.g. $content = strtoupper($content); return $content; }, 10, 1);

    Hope this helps!