WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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'm trying to change the options that are presented for the gallery settings. I can't seem to find a hook or override that gets exactly what I want. I came close with the following, but it only seems to add to the top of the tab.

function media_upload_gallery(){
echo 'test';    

add_filter('media_upload_gallery', 'media_upload_gallery');

Is it even possible to hook into that form and either replace it or edit it?


share|improve this question
up vote 2 down vote accepted

There is no way to alter the gallery settings. About the only thing you can do is to override the entire gallery shortcode. You can technically have your users pass any sort of parameters into the shortcode and recognize them with your alternate gallery.

Simply use:

add_filter('post_gallery', 'foo_override_gallery', 1, 2);
function foo_override_gallery($empty, $attr){
    //Extract the attributes
    //Create your own gallery layout
    return $output;

By returning any value to the filter, the default gallery is completely overridden. You must return HTML for this to work properly.

I know this isn't exactly what you're looking for, but it's the closest way to customize the output of the gallery shortcode. I dumped the gallery template here sans the override filter that you could put in your new function: http://pastie.org/4293527

Hope this helps.

share|improve this answer
Thanks for the answer, I see what you mean by not being able to override the settings the way I want to. The form is essentially hard coded in /wp-admin/includes/media.php. I'm still hoping to figure out a way to make this easy for the client to toggle on and off so that I do not need to rely on them typing in the attribute. Your code snippet guided me in the right direction though, so thanks! – Levi Jul 21 '12 at 4:53
@Levi Let us know what you come up with. – Brian Fegter Jul 23 '12 at 15:11

Your Answer


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

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