shortcode – gutenberg widget outputting paragraph marks

Question

I have created a shortcode to output a wp_Query. Nowhere in my query do I output any <p></p> paragraph marks. However the widget puts this before my output and after.

At first I thought maybe it was something in my code, but I created this sample version as an example:

function test_shortcode() {
    $testout="<div>hi there.</div>";
    return $testout;
}
add_shortcode ('show-test', 'test_shortcode');

I then output the shortcode in my footer widget. I’m using wordpress 5.9 and the widgets are now gutenberg. I’ve tried using the shortcode block and the widget block.

[show-test]

This is what I expect for an output:

<div>hi there.</div>

But this is what I receive:

<p></p><div>hi there.</div><p></p>

UPDATE:
For completion sake, this is the FULL widget output:

<div class="footer-widget-2">
        <aside id="block-10" class="widget inner-padding widget_block"><p></p><div>Hi there.</div><p></p>
    </aside>
</div>

I’ve tried changing themes this still happens. Does anyone have any idea what is causing the extra paragraph marks before and after? More importantly how to stop them?

0
pressword 2 years 2022-03-15T23:36:40-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse