Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I frequently need to add several Name-Value pairs to the Custom Fields of a post. At present I add these one by one, by entering the Name and Value and clicking Add Custom Field.

I'd like to speed this up by entering several pairs into a single box (textarea, prompt, whatever), and have some JavaScript parse them and add them as though I had entered them manually.

(Why JavaScript? Because I don't have access to edit any PHP or install any new plugins. I'm doing this browser-side, with Greasemonkey.)

As far as I'm aware, the Add Custom Field button submits the Name-Value pair with AJAX, but I'm not familiar enough with jQuery or WordPress to find the exact code that does this so that I can copy it.

Any pointers would be much appreciated. Thanks!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Quick search shows that related part of form is generated by meta_form() function. Start from there I guess.

Also note that you will need to retrieve from source and submit nonce that protects that form. I am not sure if submitting single field invalidates the nonce there, but that also might be the case.

share|improve this answer
    
Thanks so much, @Rarst! I will look into this. –  MichaelJW Aug 8 '11 at 9:45

Your Answer

 
discard

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.