• Hello,

    I have some custom meta boxes in a custom post type, and I am creating some custom columns for them in the add/edit screen of the custom post type.

    I can retrieve the values of a text box just fine in my manage_posts_custom_column action, using a switch case like:
    case “my_field”:
    $custom = get_post_custom();
    echo $custom[“my_field”][0];
    break;
    etc…….
    But When I try to retrieve the values of a dropdown/select box, it looks weird. It shows the value but it is prefixed by:
    a:1:{i:0;s:4:”
    and followed by:
    “;}

    So, how do I properly retrieve the values of dropdown box? I can’t find an example anywhere…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    This looks like a serialized array, try to unserialize it.

    Thread Starter eritt

    (@eritt)

    thank you. That was all I needed to help me research it….

    This works!:
    case “my_field”:
    $customdropbox = get_post_custom_values(‘my_field’);
    $customdropbox = unserialize($customdropbox[0]);
    echo current($customdropbox);
    break;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Retrieving the value of a custom meta dropdown box for use in custom columns’ is closed to new replies.