Articles of wp autop

basic shortcode – Why 1st paragraph not wrapped in p tag, but 2nd is

I’m working on a basic plugin that adds shortcodes for columns, buttons, panels, ect. Nothing new here. I haven’t altered wpautop in anyway; I’ve tried removing it and delaying it – no change. What happens with all shortcodes used is, the first paragraph isn’t wrapped within a p tag (the p tags are actually appearing […]

WordPress stripping out BR tags, need assistance

Im having a problem where WP for some odd reason is stripping out my BR tags. Ive looked online and have read a few solutions that people offered including the installation of TinyMCE advanced plugin and still….the same thing. The problem is that not matter what i do, even if i go to the html […]

Removing unneccessary p-tags (Not every p)

I removed wpautop from my theme: function disable_linebreaks($content) { remove_filter (‘the_content’,’wpautop’); return $content; } add_filter(‘the_content’,’disable_linebreaks’,1); But now, when switching between HTML and Editor ALL p-tags disappear, even the ones I coded myself. What I want is just to prevent WordPress from adding empty <p></p> – Code. Basically I’m happy with wpautop, it’s just that sometimes […]

How to automatically add paragraph tags in the Visual Editor

From my Googling, it appears as though the default behavior in WordPress is to add paragraphs automatically, but in the HTML view, regardless of what style I choose in the Visual Editor’s style drop-down (paragraph, for example), paragraph tags never appear. I also do not see wpautop() called anywhere in my theme (which I inherited […]

wpautop() when shortcode attributes are on new lines break args array

I have a custom shortcode tag with a few attributes, and I would like to be able to display its attributes on new lines – to make it more readable to content editors: [component attr1 =”value1″ attr2 =”value of the second one” attr3 =”another” attr4 =”value” … attrN =”valueN”] The reason behind this requirement is […]

Why does WP not like my <a> container?

Lately I’ve been working on some shortcodes where all the elements the shortcode produces are wrapped inside an tag. Unfortunately this is not rendered like wanted, because of the filter wpautop on the_content or whatever you’re using to display shortcodes and/or regular content. The setup Imagine that we created the following shortcode: <?php function example_shortcode($atts, […]

Is shortcode_unautop() broken?

shortcode_unautop() in /wp-includes/formatting.php is supposed to find shortcodes in a block of text and remove wrapping paragraph tags from them. I’ve been having issues with paragraph tags making it through this process. Here’s the output from var_dump($pee), which I placed at the very beginning of the function, i.e., the string before being processed: string(353) “<p>[row […]

What is wrong with this code I have to make a blockquote shortcode

I have a shortcode for a blockquote [blockquote]this is the quote[/blockquote] … this is the code. function shortcode_shortcodetest( $atts, $content = null ) { $return = ‘<div class=”blockquotewrapper”><blockquote>’; $return .= do_shortcode( $content ); $return .= ‘</blockquote>’; $return .= ‘</div>’; return $return; } add_shortcode( ‘shortcodetest’, ‘shortcode_shortcodetest’ ); so I would be expecting an output of: <div […]

Shortcode from a widget is wrapped in unwanted <p> element

I’m using Black Studio TinyMCE Widget as a rich text editor widget. In a sidebar I inserted the TinyMCE widget with a [testimonial] shortcode and some content after it. For example: [testimonial] Read more client testimonials (as a link) When I switch to the HTML tab of that widget I’ve got the following: <p>[testimonial]</p> <p><a […]

Is there un-wp_autop function?

I have a problem with WP that need your help. Some of my posts have content that was applied “wp_autop” filters already. This filter turned all double break lines into <p> tag. I want to the opposite thing: turn all <p> tag into double break lines. Do you have any suggestions? Thank you.