Okay, I have created a plugin and now want to provide shortcode to app.
Here is my only file in wp-content/plugins/my-plugin/my-plugin.php
<?php
add_action('init', function() {
add_shortcode('my-plugin', function() {
// ... my code
return 'string';
});
});
I know that plugin is activated and the callback for init is called.
But the shortcode function is never get called.
I add text [my-plugin] to a widget, and it isn't replaced as well.
What do I do wrong? How to correctly register a shortcode?