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 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?

share|improve this question
up vote 0 down vote accepted

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

share|improve this answer
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 '11 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 '11 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 '11 at 5:14

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.