Home Forums General Issues Removing the \'acf_the_content\' filter


Removing the \'acf_the_content\' filter

  • Hi!

    We are having issues with the wysiwyg field and its content filtering. We want to store all fields data into persistent object cache. This causes issues with the wysiwyg field and plugins relying on shortcode processing like Gravity Forms. When the content is loaded from cache, the shortcode is not processed and thus in the case of GF the form is not handled properly.

    To fix this we would like to remove all hooks from the ‘acf_the_content’ filter and run the basic ‘the_content’ filter for the content after loading the field data.

    What is the reason for ACF to do a custom filtering for the content instead of the basic WP one. What issues could it cause to disable this ACF feature and replace it with the WP solution?

    Thanks in advance!

    Ville @ Geniem

  • Yes, there are reasons that ACF uses acf_the_content instead of the_content. There are some minor changes in the order that filters are added, but the main reason is that ACF does not run include all the filters for WYSIWYG fields that are included for the main content field because of bugs and other issues. For example it does not include “prepend_attachment” because this causes the attachment image to be prepended for every wysiwyg field. I’m sure there are others I’m not aware of.

    I suspect that the reason that the content is not formatted when getting it from the cache is that ACF allows you to get the content of a WYSIWYG field unformattted, so it is not formatted before it’s added to the cache in the way that the main content editor is. You can solve this problem by always getting the unformatted value and then applying acf_the_content to it.

    Instead of



    $content = get_field('some-wysiwyg-field', false, false);
    echo apply_filters('acf_the_content', $content);
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Removing the \'acf_the_content\' filter’ is closed to new replies.