How to Remove Auto-Generated < p > Tags from Advanced Custom Fields

If you’re using the wysiwyg editor with advanced custom fields, you will notice that when put inside a <p></p> tag, other <p></p> will automatically generate.

Simply Don't Include the < p > Within the Page Template

Posted on: January 11th, 2019
By: Tadeo Martinez

You can use this code to remove the autogenerated tags but then it becomes more difficult to edit within the editor.

function my_acf_add_local_field_groups() { remove_filter(‘acf_the_content’, ‘wpautop’ ); } add_action(‘acf/init’, ‘my_acf_add_local_field_groups’);

A better solution I found for this is to simply not wrap the_field(); of the wysiwyg editor in <p></p> because they’re auto generated so you don’t need to.

That way, you still have full control within the editor and within the page template.

If you have any questions, please let me know in the comments, otherwise, I hoped this helped you and thanks for watching.

Music credits:

Have any questions or comments? Write them below!

Leave a Reply

Your email address will not be published. Required fields are marked *