Here is another simple idea for a case-insensitive shortcode:
/**
* Make a shortcode case insensitive via the the_content filter
*
* @param string $content
* @return string $content
*/
function my_case_insensitive_shortcode( $content )
{
$sc="test"; // Edit this shortcode name to your needs
$from = '['. $sc ;
$to = $from;
if( stristr( $content, $from ) )
$content = str_ireplace( $from, $to, $content );
return $content;
}
add_filter( 'the_content', 'my_case_insensitive_shortcode', 10 );
You could also use preg_replace(), if you need more accurate replacements.
Example:
Writing this in the post editor
[test id="1"]
[tEsT id="2"]
[TeSt id="3"]
gives the following output before the do_shortcode filter is activated with priority 11:
[test id="1"]
[test id="2"]
[test id="3"]
Related Posts:
- How to customise the output of the WP image gallery shortcode from a plugin?
- Custom media upload content for inserting custom post shortcode
- All shortcodes not working on custom theme
- enqueue script only if it is not already enqueue
- How to parse nested shortcodes?
- Adding Custom Fields for Img in Posts
- How To Ignore a Filter On Applying Filter the Content In a Function
- Shortcode display outside the div
- Pass $this to function nested in another public function of the same class
- change plugin shortcode function [closed]
- Dynamic HTML not displaying at respective place
- Calling shortcode in wp_localize_script strips result
- WordPress shortcodes & performance
- Short code for Venues
- Frontend editing, Frontend user dashboard
- Can’t get custom posts of taxonomy to show
- Shortcode doesn’t work if I directly paste its function in a template file?
- Trying to count the total number of paragraphs inside a blog article
- How Can I Pass the Shortcode’s $atts Variable to the Plugin’s Javascript Function
- Pass variable to nested shortcode
- Add custom variable in Contact Form 7 mail body
- get shortcode value
- How to generate CSS from a shortcode within a plugin
- Storing Options in a Shortcode
- Prevent shortcode from being wrapped in tags
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- How can I create a custom shortcode that will return a custom post type by ID?
- Plugin Handle URL With Custom Theme
- How to put JQuery/Ajax inside shortcode?
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Can someone please tell me what is wrong with my plugin?
- Trouble with editing template for “List category posts” plugin
- WordPress function not being called from jQuery method
- AddToAny shortcode in the loop
- How to fix wrong attribute error for Visual Composer Grid Builder?
- Making a Template for a CPT created by a plugin
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Creating shortcodes in plugin
- How to Create a shortcode to this php function
- Use $_GET inside a shortcode print empty Array
- My plugin won’t return anything [closed]
- Render Modula Plugin Shortcode On Ajax Request
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Deactivate JS Script in Plugin Shortcode
- plugin shortcode not working on ajax request call
- Shortcode not getting replaced
- How to activate a plugin on the activation of a theme?
- Plugin that provides the [edit] shortcode?
- IF condition based on wp_remote_get output
- shortcode not return any thing in Gutnburg
- Shortcode Attributes to Return different $_POST
- How to change shortcode’s default theme?
- Is there a way to convert shortcodes to html content?
- Shortcode not working – quotes seems strange
- Get param from shortcode in plugin function
- Inserting shortcode in href – any ideas or workarounds?
- Get Image Having the ID [closed]
- Add the_post_thumbnail_url to a shortcode in function.php
- Form Plugin for Api Requests which is used via Shortcode
- Echo out element to another page.
- Load CSS files in header of Bones theme?
- Adding a Tag Parameter / Filter to My Shortcode
- Filters on the_content with plugins, pages and shortcode
- Which is a better practice when writing shortcodes: pack lots of configuration parameters or just give an id?
- Elementor Pro display featured image on section -> style -> image using shortcode
- Help understanding dynamic endpoints based on where a shortcode is used
- How do I use a plugin’s shortcode attribute value in another function?
- Make the product page as homepage WooCommerce
- Image path in childs theme
- Get Shortcode output to database for static post_content
- Shortcode function not showing up on mobile browser
- Issue Saving Posts That Contain Shortcode
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- Get Current Post ID in WP Loop For GiveWP
- Shortcode generated widget to appear on same line as heading text and button
- Page takes on two different formats
- Sanitize AROUND shortcode
- Get not the full path
- Sending post data over REST API, how to parse shortcodes in post_content?
- Query Shortcode from a multisite to appear on a different site?
- shortcode which is introduced into entry the blog, and appears in side bar
- Multiple level shortcodes
- Space in WordPress Attribute Causing Problems
- Shortcode registered from a plugin not recognized
- Strange get_the_* behavior with php 5.4
- Is it right way to create shortcode?
- Trying to override/intercept a PhotoMosaic gallery link in WordPress using jQuery
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- Embedding BitBucket Code in Posting
- Do shortcodes affect page indexing by search engines?
- do_shortcodes() isn’t working
- How to show in front End images using Visual Composer attach_images?
- Seo Problems in My meta Discription [closed]
- Shortcode to do math with url variables
- How to get URL param for pagination in shortcode?
- Buffered output in chunks and shortcode – how do I achieve that?
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- How to get next day date of a specific day