How to query posts based on a portion of a meta_value (5 posts)

  1. Mike Dedmon
    Posted 6 years ago #

    I'd like to run a query that uses meta_values. The single meta_value contains a list of words. Can I structure the query so that I can say something like, return all of the posts that have a meta_value that contains the string of "list-item-3"?

    The meta_value may actually contain: "list-item-1 | list-item-2 | list-item-3 | list-item-4"


  2. esmi
    Forum Moderator
    Posted 6 years ago #

  3. Mike Dedmon
    Posted 6 years ago #

    thanks for the link. It doesn't answer my question. I've looked at that page and others for an answer.

    meta_compare= - operator to test the meta_value=, default is '=', with other possible values of '!=', '>', '>=', '<', or '<='

    I don't see a operator that is used for finding a portion of the string within the meta_value.

  4. paalbra
    Posted 6 years ago #

    I do believe I'm looking for the same answer.

    I have a meta_key and it's meta_value is an array with two items where one item is an int and the other item is a string.

    What is want is the query to be ordered with an meta_compare using the int in the array.

    How can I accomplish this? Do I have to make a own meta_key for the int so that the value will become the int I'm looking for, or can I somehow use orderby on a part of the array contained in the meta_value?

  5. Tammy Hart
    Posted 6 years ago #

    Also looking for this answer. I found this, but I can't seem to decipher it: http://old.nabble.com/meta_value-contains-text-td24995719.html

Topic Closed

This topic has been closed to new replies.

About this Topic