WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to make a simple plugin that sets a background image. I have it linked to the media library so that when you click "Insert into Post" it does a custom function. However, obviously this custom function is undesirable in any other context. As such I would like to make a separate button "Make Background" that would call the custom function. Any ideas?


share|improve this question

If you want it to show up in the image edit, say next to "insert into post" you will need to hook into

//for instance
add_filter( 'attachment_fields_to_edit', 'yourfunction', 1, 2 );

Have a look at media.php http://mobile.adambrown.info/p/wp_hooks/hook/attachment_fields_to_edit?version=3.1&file=wp-admin/includes/media.php

share|improve this answer
Ok cool, looks promising, so 'yourfunction' would just echo a html button? And how could I get that button to do something? With the "Insert into Post" I can just hook into it's default function to do my own thing. – user4462 Apr 5 '11 at 19:20
the yourfunction could be any function or functions really, I just used that as an example. – Wyck Apr 6 '11 at 6:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.