WordPress not saving tags for custom taxonomy term description
WordPress not saving tags for custom taxonomy term description
WordPress not saving tags for custom taxonomy term description
Disable wpautop on Shortcode attributes
Line Breaks are stripped off when direction property is found
yes, you can deactivate the autop for shortcode via filter add_filter( ‘the_content’, ‘shortcode_unautop’ );
Here is one idea add_filter(‘the_content’,’remove_stuff’,99,1); function remove_stuff($content){ $from=array(“<p><script>”,”</script></p>”); $to=array(“<script>”,”</script>”); $content=str_replace($from,$to,$content); return $content; }
Manipulating HTML with regular expressions is not a good idea. I suggest you use DOMDocument: // input $html = apply_filters(‘the_content’, get_the_content()); $dom = new \DomDocument(); $dom->loadHtml($html); $blockquotes = $dom->getElementsByTagName(‘blockquote’); foreach($blockquotes as $blockquote){ foreach($blockquote->childNodes as $e){ if($e->nodeName === ‘p’){ // create a text node with the contents of the <p> $blockquote->insertBefore($dom->createTextNode($e->textContent), $e); // remove <p> $blockquote->removeChild($e); … Read more
Generally it’s not a common way to strip wpautop with remove_filter as it is native functionality of WordPress. But if you want to : place the remove_filter() function right before the the_content() function on the pages/templates where you don’t need the wpautop <?php remove_filter( ‘the_content’, ‘wpautop’ ); the_content();?>
Well, removing autop filter from the_content filter tag makes no sense here, because you never apply the_content filters in your code… Let’s take a look at the source code of the_content() function: function the_content( $more_link_text = null, $strip_teaser = false) { $content = get_the_content( $more_link_text, $strip_teaser ); $content = apply_filters( ‘the_content’, $content ); $content = … Read more
WP’s text widget doesn’t run text through the_content filter, it applies wpautop() on saved text explicitly in code: <div class=”textwidget”><?php echo !empty( $instance[‘filter’] ) ? wpautop( $text ) : $text; ?></div> This is controlled by aptly named “Automatically add paragraphs” setting at the bottom of the widget.
The WordPress implementation of the TinyMCE editor automatically adds <p> tags. There’s a few options for removing, as explained in a tutorial on removing <p> tags. I would recommend the following approach, which is a slight modification from that tutorial (as it involves messing with core wp functions). Add the following code to your functions.php … Read more