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

I am using the Advanced Custom Fields plugin and want to read the value of the custom fields. For dropdown and text fields, this is straightforward as the value is kept in plain text, so the get_post_custom_values functions works.

For multi-select field, however, ACF keeps data like this:


So the sensible thing to do is to use the get_value function from ACF to read the value and parse it into objects.

In the ACF plugin, the first line does:

$acf = new Acf();

So I assumed I could just use the $acf variable in my plugin and do:

$afc->get_value ($post_id, $key);

but received error with

PHP Notice:  Undefined variable

I am new to php development so I might not have understood the scoping rule correctly. So, what's the right way to do this and what am I doing wrong?

share|improve this question

The multi-select field you referenced appears to be stored in PHP serialized format, which is used for "storing or passing PHP values around without losing their type and structure".

To unserialize a custom field value you need to use the unserialize() function:

$multi_select_field = unserialize( get_post_meta( get_the_ID(), 'custom_field_key', true ) );
share|improve this answer
Thanks for your answer, I will try out this approach. However, I would still like to know how I can call a function from another plugin. – ltfishie Mar 14 '12 at 21:55

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.