I am trying to update my plugins to be more user-friendly. One of the things i want to achieve is that i want my plugins output (e.g. for description-fields) to use the full functionality of all normal wordpress posts and pages (use TinyMCE and Loop-Output).

I've found a great article on using the tinyMCE right here but what I'm still stuck at is the usage of loop formatting by other plugins.

Given Example: I use a download manager plugin. In custom posts and pages i can write [download id=1] and it get's nicely formatted by the asociated plugin. I want this functionality in my custom plugins, too.

Right now this is the way i do my plugin output:

add_filter('the_content', array(&$myclass, 'myclass_callback'), 7);

and myclass_callback is the following:

public function myclass_callback($sIn)
  if (isset($_GET['myc_id']) && is_numeric($_GET['myc_id'])) {
    $sOut = $this->myclass_detail((int)$_GET['myc_id']);
    return str_replace('[[MYCLASS_TAG]]', $sOut, $sIn);
  $sOut = $this->myclass_index();
  return str_replace('[[MYCLASS_TAG]]', $sOut, $sIn);

And this approach doesn't bring my wanted result :) So i am trying to figure out how to, but apparently I'm not good enoug of a googler to do so :S

Any links or keywords for me to search for will be greatly appreciated. Thanks in advance!

  • 2
    can you edit out the solution and post it as the answer instead?
    – Tom J Nowell
    Mar 2, 2012 at 10:22
  • Of course, makes a little more sense, too.
    – Sam
    Mar 2, 2012 at 14:46
  • Hi Sam - could you mark your answer as correct by using the tick on the left hand side. It clears up the question from the unanswered pile :) Jul 2, 2012 at 23:11
  • @StephenHarris Of course, didn't really take note on the other SE-Sites lately - done ;)
    – Sam
    Jul 3, 2012 at 4:47

1 Answer 1


The Solution to my problem is to simply let my plugins output run through the do_shortcode()-Function of WordPress as pointed out by this article: Using Shortcodes Everywhere

I updated my plugin so it uses shortcodes, too, so now my output looks like this:

// Add this upon plugin initialization
add_shortcode( 'dosomethingawesome', array( &$this, 'output_callback') );

 * Plugins output
 * Fetches the output from handle_callback() and then runs it through the
 * do_shortcode() function to work with other plugins, too
 * @uses do_shortcode()
 * @access public
 * @return string
// {{{ output_callback()
public function output_callback() {
  $sOutput = $this->handle_callback(); //returns the string of my plugins action
  return do_shortcode($sOutput);
// }}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.