add_shortcode parsed incorrectly.
-
The short-code parser incorrectly parsed the attribute value even when the magic character “]” within the quote mark.
Sample code:
info-box-parser.php
<?php /* * Plugin Name: Short-Code Bug Test * Description: Short-Code Bug Test * Version: 1.0 * Author: Jixun.Moe */ function infobox_parse ($atts, $content = null) { echo "--- [ ATTS ] ---\n"; var_dump ($atts); echo "--- [ CONTENT ] ---\n"; var_dump ($content); echo "--- --- --- --- ---"; return $content; } add_shortcode ('infobox', 'infobox_parse');
Post content:
[infobox title="[tag1] [tag2] title"][/infobox]
Expected result:
--- [ ATTS ] --- array(1) { ["title"]=> string(19) "[tag1] [tag2] title" } --- [ CONTENT ] --- string(0) "" --- --- --- --- ---
Actual output:
--- [ ATTS ] --- array(1) { [0]=> string(12) "title="[tag1" } --- [ CONTENT ] --- string(21) " [tag2] title”]" --- --- --- --- ---
Thanks in advance.
- The topic ‘add_shortcode parsed incorrectly.’ is closed to new replies.