Forums Forums Search & Filter Pro Serialized Post Meta

  • This topic has 3 replies, 2 voices, and was last updated 9 years ago by Ross.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Ross Moderator
    #32117

    Hey Felipe – is this data you are saving in some kind of custom function?

    Thanks

    Anonymous
    #32151

    Yes it’s a custom function. Is this a problem?

    Ross Moderator
    #32234

    Possibly – there are few issues here to consider

    It looks like you might be nesting the data too much.

    For example, you can save multiple values to one meta key – so you wouldn’t need one object like that, you would have separate entries for your options under a different key just for options:

    https://codex.wordpress.org/Function_Reference/add_post_meta

    Take a look at the unique option.

    In addition to this, the key you want searching contains a bunch of other info you do not want to be searched such as name, description, radiobutton etc – so the format here is not correct – labeling and field data should be stored in a different key, and your data in another

    Even with the above, I think there is still too much nesting.

    Even if S&F is able to search inside this field, semantically I can’t see how you would search this field.

    In search and filter, you can create a field, and this field is bound to 1 meta key. So it would look in all that data, prices, label, min, max etc

    So if you choose to use this key to create a dropdown, then what kind of data is it searching? You will be trying to use 1 dropdown to search all that data. To me it doesn’t really make sense, but then again I do not know your use case.

    What I would recommend to do is use either the WP Types plugin, or Advanced Custom Fields plugin to try to achieve what you want.

    By all means, remove them after some testing, but use them initially to observe how they are storing the data and the kind of relationships the post meta can have with the post itself.

    Hope that helps.

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)