Home › Forums › General Issues › Removing Paragraph Tags from WYSIWYG Fields? › Reply To: Removing Paragraph Tags from WYSIWYG Fields?
I tried the function like Elliot showed above and it worked great!
I did one per filter for the moment in my header.php:
function the_content_without_filters( $the_content=null ) {
remove_filter('the_content', 'wpautop');
if( $the_content ) {
the_content( $the_content );
} else {
the_content();
}
add_filter('the_content', 'wpautop');
}
function the_excerpt_without_filters( $the_excerpt=null ) {
remove_filter('the_excerpt', 'wpautop');
if( $the_excerpt ) {
the_excerpt( $the_excerpt ) ;
} else {
the_excerpt();
}
add_filter('the_excerpt', 'wpautop');
}
function the_field_without_filters( $the_field=null ) {
remove_filter('acf_the_content', 'wpautop');
if( $the_field ) {
the_field( $the_field );
} else {
the_field();
}
add_filter('acf_the_content', 'wpautop');
}
I guess you can also inverse if you need to:
function the_field_without_filters( $the_field=null ) {
add_filter('acf_the_content', 'wpautop');
if( $the_field ) {
the_field( $the_field );
} else {
the_field();
}
remove_filter('acf_the_content', 'wpautop');
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.
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.