Is there a built-in filter to add a custom icon and function to the WordPress "Uploads/Insert" toolbar? This is the toolbar that's located just above the content editor. The existing icon I want to replicate is shown in the blue circle of the image below.

I'd like to add a custom icon that loads the "Add an Image" wizard and passes a special parameter to the upload function such that the attached images get a special meta attribute they would not ordinarily get when uploaded via the standard icon.

The editor toolbar showing the location of the menu I'm interested in adding to

Update: With the help of tnorthcutt's answer below, I've managed to hook into the media icon filter. From here, I should be able to attach a jQuery click event to the image or href and trigger the opening of the media-upload.php, passing a parameter to process the uploads as special...

//Upload custom images
function addMediaIcon($initcontext)
    return $initcontext.
   ' <a id="myID" 
      onmousedown="return false;" 
      onclick="return false;" 
      onclick="javascript:alert()" title="" />
add_filter('media_buttons_context', 'addMediaIcon');

2 Answers 2


I'm inclined to say that this is possible. For instance, the Gravity Forms plugin adds an image here. Start with looking at the media_buttons_context hook.

  • yep, that's the one. I'm looking at a few examples now > wordpress.org/support/topic/…
    – Scott B
    Commented Nov 18, 2010 at 20:30
  • It's definately possible, the polls plugin on wordpress.com blogs does just that...of course i can't speak of implementation right now, but it's definately possible is all i'm saying..... ;)
    – t31os
    Commented Nov 18, 2010 at 22:36

You can also find a good example of using the media_buttons_context filter on the following page. http://www.morgadinho.org/2009/10/16/wordpress-media-buttons/

I know this probably covers what you have already, but wanted to share the link all the same... ;)

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.