• Hi,

    I want to have 15 custom fields for custom post type posts. Is it better to have each of those fields as separated meta keys or have a single meta key for each post with all fields serialized?

    Thanks

    ps.: when i say custom fields i mean entries from custom meta box form

Viewing 2 replies - 1 through 2 (of 2 total)
  • I typically lean towards grouping all similar items into an array. That way, you make a single db call; instead of 15 separate calls.

    In this case; all options (regardless if they are similar or not) are going to be saved to the post meta. You don’t have to worry about serialization or unserialization; because the update_post_meta() and get_post_meta() functions will handle the serializing for you.

    Just my $0.02 🙂

    Thread Starter SGURYGF

    (@sgurygf)

    thanks for your reply. However even though is more tidy and easy to get/update them, its a real pain in the ass to filter/search by a specific value 🙂

    I have noticed that most plugins use separate meta keys instead of one with array values.

    • This reply was modified 7 years, 7 months ago by SGURYGF.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple Postmeta vs Single’ is closed to new replies.