Home › Forums › General Issues › Removing Paragraph Tags from WYSIWYG Fields? › Reply To: Removing Paragraph Tags from WYSIWYG Fields?
I, too, am trying to use this same method but with a get_sub_field call. I have modified Elliot’s original code but I’m unable to get the field without the wpautop happening. Any suggestions on this one?
Here’s what I am attempting to use:
function get_sub_field_without_wpautop($field_name) {
// Temporarily remove the filter for this get_sub_field call
remove_filter('acf_the_content', 'wpautop');
// Get the sub field without the wpautop filter
$field = get_sub_field($field_name);
// Re-establish the wpautop filter for everything
add_filter('acf_the_content', 'wpautop');
// Return our non-wpautop'd field
return $field;
}
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.