Home Forums General Issues remove wysiwyg wptexturize filter


remove wysiwyg wptexturize filter

  • Hey guys,

    Is there a way to remove the wptexturize filter from the ACF WYSIWYG field type? I know I can do it for the_content() by using the following function but it doesn’t seem to work for ACF?

    remove_filter ('acf_the_content', 'wptexturize');

    Any help would be greatly appreciated! Cheers.

    • Elliot

    • September 2, 2013 at 12:31 pm

    Hi @rockethouse

    I have a feeling that currently, there is no way to remove the ACF filter. I’ll add this to the to-do and have it fixed in the next version.

    For now, you can load the value without any formatting like so:

    get_field('field_name', $post_id = false, $format = false);

    Hope that helps

  • Cheers for the quick reply!

    I tried that but unfortunately it didn’t work… for now i’ve ended up just commenting out the filter from wysiwyg.php.

    the field i’m using is a sub / repeater field so maybe thats why?

    This is what I tried:

    echo get_sub_field('content', $post_id = false, $format = false);

    • Elliot

    • September 3, 2013 at 12:46 pm

    Hi @rockethouse

    Yes, sorry, currently there is no way to stop sub fields from becoming formatted…

    Hmmm, I’ll look into this too


    • Elliot

    • September 24, 2013 at 4:12 pm

    Hi @rockethouse

    Just wanted to follow up and let you know I have made some changes to the WYSIWYG field in hope that it will solve your original issue.

    All the add_filter functions for acf_the_content have been moved to the root of the wysiwyg field file, so you should be able to unhook them in your functions.php file.

  • Good man! – I will test it out when I’m back on that project… cheers for that – appreciate the response.

  • Hi @elliot,

    I tried to unhook the filter as rockethouse suggested at the beginning of the conversation and it doesn’t seem to work for me. It should be as easy as putting this: remove_filter( ‘acf_the_content’, ‘wpautop’ ); in my functions.php, isn’t?

    No joy though 🙁

    Thanks for all your work.

    • Elliot

    • October 23, 2013 at 5:16 pm

    Hi @aleish76

    The remove_filter will not work with the current ACF 4.2.2, but will work with ACF 4.3.0 which you can find in github and will be released shortly.


Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.