Skip to content

@kovshenin /shortcodes-test.php
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Here's why you should not use dashes in WordPress shortcodes
<?php
// Shortcodes
add_shortcode( 'my', function() { return 'my'; } );
add_shortcode( 'my-shortcode', function() { return 'my-shortcode'; } );
add_shortcode( 'my_shortcode', function() { return 'my_shortcode'; } );
/**
* Results:
*
* [my] - my
* [my-shortcode] - my (didn't expect it, did you?)
* [my_shortcode] - my_shortcode
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.