Remove some tags from shortcodes output? Trying to fix autop
I think it’s because of invalid markup. autop is trying (poorly) to fix code. Change your divs to spans and in your stylesheet set them as block.
I think it’s because of invalid markup. autop is trying (poorly) to fix code. Change your divs to spans and in your stylesheet set them as block.
I believe this is what you are after: // define $post_id, $key, $single $multipleLineValue = get_post_meta($post_id, $key, $single); // Convert into an array where desired code can be added to the output $multipleLineValue = explode(“\n”,$multipleLineValue); $output = “”; foreach ($multipleLineValue as $lineValue) { $output .= “<span>”.$lineValue.”</span><br>”; } echo $output;
The function that does what I think you are referring to is wpautop(), probably the most complained about function is all of WordPress-dom. It is a filter on the the_content hook among others. You can remove that with: remove_filter(‘the_content’,’wpautop’); I would suggest that you spend some time looking through the many related questions to see … Read more
Inline style appears in the editor but breaks on live site
It was solved by a coworker. function removebreaks($content) { $content = str_replace(‘<br>’, ”, $content); $content = str_replace(‘<br/>’, ”, $content); $content = str_replace(‘<br />’, ”, $content); $content = str_replace(‘<BR>’, ”, $content); $content = str_replace(‘<BR/>’, ”, $content); $content = str_replace(‘<BR />’, ”, $content); return $content; } add_filter(‘acf_the_content’, ‘removebreaks’);
Why are manually placed paragraph tags being removed? I can’t say for sure. I found one support thread which suggested it was being removed by the editor. My own testing deems this to be untrue. My local development server also doesn’t appear to have any of these problems, except for the insertion of paragraph tags. … Read more
This question has been answered here You need to “add a simple filter function” to functions.php file for the theme via regex.
Since any attribute added to <br> tag, including class names and data-attrs keeps them from stripping, quick and incomplete way could be: function filter_function_name( $content, $post_id ) { $content = str_replace(‘<br>’, ‘<br data-x>’, $content); $content = str_replace(‘<br >’, ‘<br data-x>’, $content); $content = str_replace(‘<br />’, ‘<br data-x>’, $content); $content = str_replace(‘<br/>’, ‘<br data-x>’, $content); return … Read more
You could try this in your functions.php file function disable_wpautop_for_pages(){ if ( is_page()){ remove_filter( ‘the_content’, ‘wpautop’ ); } } add_action(‘init’, ‘disable_wpautop_for_pages’); I have not tried this. It’s just a guess
Understanding automatic text formatting in the WordPress editor