I want to allow users to upload images for use in a rotating banner. I tried using the media library, but didn't get much help ... So I thought, I'd just implement the upload myself. But I encountered another problem... I am using the settings API they do the update options and stuff for me. How can I handle the upload then?

I thought of using the validate callback to upload images and then set $_POST variables manually so that Settings API can save those. But it sounds wrong. Any ideas?

1 Answer 1


You should only need a list of URL's selected from the Media Loader. There are others out there, but I have a Theme Options Panel for your admin that is Settings API compliant. It has an 'upload' option that uses the Media Loader to upload a file and fill a text field with the returned URL of that file. This is saved as an option with the Settings API. Perhaps you can get an idea from that. You could provide a pre-set amount of 'upload' options (5 URLS/images for example) or modify the code to handle it differently.

Theme Options Panel Framework

  • What version of WordPress are you using? I think in WP3 or 3.1 post_id is required? I am able to show the media library popup but selecting images does nothing
    – JM at Work
    Jun 14, 2011 at 1:59
  • Version 3.1.3. I just tested it again and it works fine with my Options Panel. No post_id required because with the Media Loader, you wouldn't always be inserting into a post. When you say it doesn't work, are you referring to your code or mine?
    – Jeff
    Jun 14, 2011 at 4:02
  • Ok I went to ur link b4. But I'll try it later or when I have time
    – JM at Work
    Jun 14, 2011 at 5:14

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.