Remove empty p-Tags in Shortcode content before non p-Tags

We build a media (based on bootstrap 4 media object) shortcode with the following syntax: [media img=”https://via.placeholder.com/64×64.png”]<h5>List-based media object</h5>Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.[/media] … Read more

WordPress editor strips out anchor tags when they appear on their own line

In the text below, when I toggle the WYSIWYG view from Visual to Text, the anchors are left intact. However, when I switch back to Visual, the anchors are replaced with &nbsp; elements. This is the initial content markup in the WordPress editor (via Chrome inspector): <body id=”tinymce” class=”mceContentBody content post-type-post post-status-publish post-format-standard wp-editor” onload=”window.parent.tinyMCE.get(‘content’).onLoad.dispatch();” … Read more

Why does WP not like my 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, … Read more

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 … Read more

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 … Read more

WooCommerce Description and Short Description tags removal

When adding content into the description and short description fields for a product, line-breaks and tags are completely removed from the markup. Other than installing Advanced TinyMCE, is there any setting, filter, or hook I need to check to make these fields include elements. In review of the Product object array in WooCommerce, it looks … Read more

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 … Read more

Creating a table from shortcode avoiding wpautop for each row

I’m probably doing this all wrong, and there’ll be a much simpler solution. Basically, I’m trying to build a table of tour dates that’ll be editable by someone with little technical knowledge, but can handle shortcodes. There’s also some custom functions in the table (with regards to displaying the date, and having an expiring ticket … Read more