WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Been stuck on this for a while now. Haven't come across anything that has shed any light on it for me... Pardon my ignorance... quite a newbie at this level of php.

The problem: I am using the wp-property plugin, but need a field that can have multiple numeric values. Using Advanced Custom Fields to set up a checkbox field that can accept multiple numeric values. I am attempting to add this field to the wp-property search function. I get a dropdown menu, but it is populated with lines that look like unformatted arrays.

s:19.a:1:{i:0;s2 and so on. My values are in that string but I don't know what to do to single them out.

I have this in my functions.php

add_filter('wpp_searchable_attributes', 'add_lease_to_searchable');
 function add_lease_to_searchable($fields) {


array_push($fields,  'lease-space1' );

return $fields;

Which gets that dropdown to be a part of the wp-property function. If anybody has an idea on how to extract the values... even better put one on each dropdown line, that would be amazing. Feel stuck with no light at the end of the tunnel.

share|improve this question

It's a serialized string. Use Unserialize to get an array out of this. Also checkout WP's maybe_unserialize method.

<?php $string = "s:19.a:1:{i:0;s2";

//Using WP maybe_unserialize
$result1 = maybe_unserialize($string);

//Using PHP unserialize
$result2 = unserialize($string); 

echo "<pre>";
echo "</pre>";

$result will hold what you want.

share|improve this answer
thanks for the incredibly quick answer. This site is definitely a resource I am happy to have found. But I think I am just in over my head. – noel Aug 5 '11 at 17:25
You're welcome! You've found the best place to get an answer for all your WP related questions! :) BTW, did the solution work? (I really don't understand what 'But I think I am just in over my head.' means !) – Rutwick Gangurde Aug 6 '11 at 3:20
Unfortunately I am too much of a newbie to even understand how to use that method with my current code. And I am not truly confidant that I am attempting to solve the appropriate problem for my particular issue. I suppose that is what I mean by "over my head." :( – noel Aug 6 '11 at 5:12
No problem Noel! Everyone goes through that stage, even I did! :) – Rutwick Gangurde Aug 6 '11 at 8:34
I may never make it to PHP ninja stage, but there are many ways to skin a cat. I decided to go the custom taxonomy route to fix my issue... and the developer of the main plugin plans to implement taxonomy search in the somewhat near future... so I think that will work for now! Thanks again for taking the time to respond. I will continue to visit this site as part of my learning process! best--- – noel Aug 8 '11 at 4:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.