Support

Account

Home Forums General Issues remove wysiwyg wptexturize filter

Solving

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.

  • 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);

  • Hi @rockethouse

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

    Hmmm, I’ll look into this too

    Cheers
    E

  • 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.

  • 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.

    Thanks
    E

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

The topic ‘remove wysiwyg wptexturize filter’ is closed to new replies.