I was wondering if it is possible to make shortcode not case sensitive, should be pretty straight forward but I want:
[test=1]
to work while written as
[TeST=1], [TEST=1]
And if so, how do I do it?
I was wondering if it is possible to make shortcode not case sensitive, should be pretty straight forward but I want:
[test=1]
to work while written as
[TeST=1], [TEST=1]
And if so, how do I do it?
Comments are closed.
Here is another simple idea for a case-insensitive shortcode:
You could also use
preg_replace()
, if you need more accurate replacements.Example:
Writing this in the post editor
gives the following output before the
do_shortcode
filter is activated with priority11
:If you’re talking about a shortcode you’ve created yourself, you’d have to register all possibilities of case.
If you want all shortcodes to be case-insensitive, you’d have to modify the shortcode handling code in the WordPress core includes (or override it I guess…)
This question Are shortcodes case-sensitive? has some info on the necessary functions you’d have to modify.