Having trouble saving data?

If the data vanishes from your custom fields after saving your post, there are a few things you should check. Have you correctly hooked into the save_post action in your index.php file and are you passing it the correct arguments? Without your customized save function, WordPress will ignore the data in your custom fields.

When editing your post with custom fields, view the source HTML. Search for your $prefix that you defined in your class. Are your form elements using this as part of the field names? You should see elements with names prefixed, for example:

<input type="text" name="custom_content_my_text" id="custom_content_my_text" value="" />

Next, you should see what's coming through after the form is posted. At the ...

Get WordPress 3 Plugin Development Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.