[shortcode] Parameterized shortcode callback via new add_shortcode() arg
-
A new third argument to add_shortcode() would allow parameterized shortcodes via callback overloading:
function add_shortcode($tag, $func, $merge_atts)
Example:
add_shortcode('foo1', 'mycallback', array('arg1' => '1'))
add_shortcode('foo2', 'mycallback', array('arg1' => '2'))I do lots of text replacements via shortcodes, and currently have to finagle this through content (
[foo]arg1[/foo][foo]arg2[/foo]
versus[foo1/][foo2/]
).I can’t think of any downside to parameterized callbacks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[shortcode] Parameterized shortcode callback via new add_shortcode() arg’ is closed to new replies.