WordPress.org

Forums

Problem saving meta boxes with multiple custom fields on custom post types (2 posts)

  1. kuching
    Member
    Posted 3 years ago #

    I'm trying to develop a theme that makes intensive use of custom post types, meta boxes and custom fields. Some meta boxes have one single field, some other should have several.

    Custom post types and taxonomies created for them are working fine. What does not work is having meta fields saved/updated in meta boxes that have more than one custom field in it.

    After having created custom post types and taxonomies, I've added a few meta boxes:

    http://pastebin.com/FX3z7QEV

    There are actually many many more, but above it's just a sample of two metaboxes, "product_slogan" will have only one meta field while "product_facts" will have at least 8 custom fields.

    this is product_slogan:

    http://pastebin.com/9VApsN5r

    and this is product_facts - inside product facts there are 8 custom fields (productfact1, productfact2...)

    http://pastebin.com/8BFHkMJT

    at last, I want to save all the meta boxes for the custom post type "product", that should include "product_slogan" and "product_facts", and their contents - I added a hidden nonce input as well, and this is the code I used to save custom meta boxes / fields:

    http://pastebin.com/cGfH51ng

    my problem is that meta boxes like "product_slogan" that contain only one custom field ("product_slogan" itself) get saved or updated when I save the post, while meta boxes that contain multiple custom fields like "product_facts" do not get saved/updated. I have the same issues with other custom post types or meta boxes in the same page. I think I'm doing something wrong with meta boxes containing multiple fields. How do I solve this?

    Any help is really appreciated!

    thanks

  2. kuching
    Member
    Posted 3 years ago #

    updated post as for moderator instructions

Topic Closed

This topic has been closed to new replies.

About this Topic