• i am using meta_value to search a custom field with a key of species
    The way the data is stored is in an array how can i still use meta_value and be able to find the posts with dog for example?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Use query_posts or get_posts with arguments such as

    $args=array(
      'showposts' => -1,
      'meta_key' => 'species',
      'meta_value' => 'elephantopus ',
      'meta_compare' => '='
    );
    Thread Starter slee

    (@slee)

    unfortunately i tried that with no joy it returns nothing.

    this is how the data is stored:
    a:11:{i:0;s:16:"Air Conditioning";i:1;s:10:"Dishwasher";i:2;s:
    9:"Fireplace";i:3;s:15:"Hardwood Floors";i:4;s:20:"Over-Range
    Microwave";i:5;s:10:"Waterfront";i:6;s:12:"Deck / Patio";i:7;s:
    12:"Washer/Dryer";i:8;s:6:"Stable";i:9;s:4:"Barn";i:10;s:12:"Laundry
    Room";}

    The above code is not my exact code only what i found on the flutter website.
    i am using Flutter to input the data.

    the meta_value works fine for my other custom fields but on this one with the array it does not.

    Storing custom fields as serialized arrays is a bad ideea precisely because it’s hard to search through them afterwards.

    Flutter should store each value separately.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘search in custom field if custom field is an array’ is closed to new replies.