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 have a simple list (ul>li) which is manipulated with jQuery UI in a custom meta box.

How would I go about saving the contents of the list during post save?

I already have the save function ready, but how do I get the HTML data into PHP so I can put it in the database with update_post_meta?

The list looks like (with class names etc):

    <li>Text 1</li>
    <li>Text 2</li>
    <li>Text 3</li>

'Text 1, Text 2, Text 3' would be saved.

share|improve this question
Difficult to tell without seeing the code. But, what about making a mirror inside a hidden input field, which will handle the data to be saved? – brasofilo Feb 28 '13 at 16:24
That's kind of the process I'm trying at the moment, hidden input that keeps track of the items as a comma separated list, didn't know if there was a 'proper' way to do it. – Kayo Feb 28 '13 at 16:26
AFAIK, only form data will be submitted... – brasofilo Feb 28 '13 at 16:27
A hidden textarea box did the trick, used javascript to update it every time the list was rearranged. – Kayo Feb 28 '13 at 17:11
Please mark the answer below as accepted. – funwhilelost Mar 25 '13 at 23:35

This can be done with a hidden input field. Make jQuery reflect the contents of the visible list into the hidden field.

Update the meta data using this field and build the initial list based on its values.

share|improve this answer

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.