• I am a more or less experienced php-programmer and started with plugin-development some days ago by changing an existing years-old plugin. I already read the Shortcode API but I was not able to find a hint for my following problem.

    The problem is that i added a shortcode named “snk” with three parameters. I added it through the plugin-api by calling
    add_shortcode('snk', array(&$this, 'inline_kalender'));

    If the shortcode is used, the output it produces is duplicated and so echoed two times, directly after another. The duplicated output is 100% the same, including the complete backtrace and the microtime of the function-call. I really do not understand why this happens and would appreciate any help. 🙂

    This is the code of my function for the shortcode:

    public function inline_kalender($attr) {
    	$ssid = isset($attr['ssid']) ? $attr['ssid'] : get_option('kalender_ssid');
    	$elementcount = isset($attr['elementcount']) ? $attr['elementcount'] : '0';
    	$externalTemplateName = isset($attr['externalTemplateName']) ? basename($attr['externalTemplateName']) : '';
    
    	$buffer = ob_start();
    
    	// including template (only outputs html)
    
    	return ob_get_flush();
    }

    PS: If I remove the $buffer-line and return true instead of ob_get_flush, then the output is echoed only once, as it should be.

    Thanks for any help. 🙂

The topic ‘[own Plugin] duplicate Shortcode-Output’ is closed to new replies.