I place the following code within the WP 'init' callback (or when plugins are loaded).
add_shortcode('my_shortcode',
function($atts, $content ='') { die(); }
);
if (!shortcode_exists('my_shortcode')) die();
In my page I put "[my_shortcode]"
When I view the page I get "****"
Any idea what happened to my code?
Update: I have simplified the problem.
I added the shortcode definition in my theme's index.php file.
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_shortcode('myt_active_plugins',
function($atts, $content, $name) {
return 'Shortcode injected';
}
);
I deactivated all plugins.
I (re)installed WP3.5.2
I created a post:
Welcome *[myt_active_plugins]*
I published the post and when I viewed it I got:
Welcome **
As a final check I installed a shortcode plugin, (Shortcodes Ultimate) and it acted the same.