For some reason, Wordpress removes most of the HTML markup from shortcode output while I need to use HTML markup inside those shortcodes.
There are a couple of suggestions on Stackoverflow but none of them worked for me. Let's take an example.
I call my shortcode in WP with a simple [myshortcode id="1"]
In my PHP, I use this:
function myshortcode($atts)
{
ob_start();
?>
<ul><li>test</li><li>test2</li></ul>
<?PHP
return ob_get_clean();
}
add_shortcode( 'myshortcode', 'myshortcode' );
The output I get is: test1test2 without the HTML markup
If I use links (www), they are preserved but div, span, ul, li, ... are systematically removed.
I have tried to add the markup in the end with the return statement but it doesn't work. I have tried what is suggested here https://codex.wordpress.org/Shortcode_API#Output but it doesn't work.
Do you have any idea?
Thanks!
Laurent