Handle unclosed shortcodes
-
Hey,
Today I encountered an “issue” with a custom shortcode. So I’m doing basically just something like this:function bartag_func( $atts ) { $atts = shortcode_atts( array( 'foo' => 'no foo', 'baz' => 'default baz' ), $atts, 'bartag' ); return "foo = {$atts['foo']}"; } add_shortcode( 'bartag', 'bartag_func' );
The shortcode itself works fine, where I got a headache, was when I forgot in a long article just to close the shortcode. So I had
[bartag foo="test" // ... a lot of stuff ... [bartag foo="test2"]
It seems to work, because the other shortcode closed it? But it swallowed all my content in between without complaining about it. I think this should be handled somehow.
Can I e.g. check manually for content length of the shortcode?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Handle unclosed shortcodes’ is closed to new replies.