O'Reilly logo

WordPress 3 Plugin Development Essentials by Everett Griffiths, Brian Bondari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required