Support » Plugins » Hacks » Multiple custom fields or serialized array in single custom field

  • Hey there fellow WordPress maker.

    I have a question that is not really a question. It’s more of a “what you think is a better approach”.

    Senario:
    I have to make a plugin where a post holds some extra info in custom fields.
    it should look something like this:

    Post 1
    	Value group A
    		Value A - Value B - Value C
    	Value group B
    		Value A - Value B - Value C
    	Value group C
    		Value A - Value B - Value C
    
    Post 2
    	Value group A
    		Value A - Value B - Value C
    	Value group B
    		Value A - Value B - Value C
    	Value group C
    		Value A - Value B - Value C
    
    ...

    I can get each value stored in a separate custom field or i could serialize all the value of group A and store them in 1 custom field.

    What i’m wondering is if performance wise it’s better to have 25 custom fields with little data in each, or only 2-3 custom fields with serialize data and have php do the work.

    What’s your 2 cent on this ?

    Thank for your opinion !

Viewing 3 replies - 1 through 3 (of 3 total)
  • What kinds of values will these fields hold?

    Value would be something like

    Post 1
    	Color A
    		is_default (true/false) - thumbnail url (string or attachment ID) - thumbnail url (string or attachment ID)

    So, it’s not much data to store in each group.

    thank

    If you’re storing urls, then it might be best to use separate fields rather than a serialized array. Trying to change urls in serialized arrays after a site move is pretty hellish.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple custom fields or serialized array in single custom field’ is closed to new replies.