• I have an array, part of which is the string:
    s:21:”a:1:{i:0;s:4:”2276″;}”;

    I know that 2276 is a postID for a custom post type. How can I use this string? what does it all mean? What is the easiest way to get just he ID so I can then query the post for title et cetera?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter jodaem

    (@jodaem)

    thanks, in my case:
    $post->event_attributes[‘location’] = s:21:”a:1:{i:0;s:4:”2276″;}”;

    so when I wrap this in two unserialize functions;
    $array = unserialize(unserialize($post->event_attributes[‘location’]))

    I can echo $array[0]; to get the ID i needed.

    Does this seem like a good method or is there a cleaner way to extract this data?

    What’s the name of the option that this is being stored against in wp_options?

    Thread Starter jodaem

    (@jodaem)

    Sorry I’m not sure about the option reference. I can give you a bit more detail however.

    I am using a plugin called Event Manager and it produces an array of information. part of which is a post object reference created by a related Advanced Custom Fields setup with the custom post type of “location”. Normally ACF Post Objects are directly accessible via the output array. However with EM the array is put into the format originally posted.

    If you had the option name, you could call & unserialize it simultaneously using get_option(). Try asking for the option name on the plugin’s dedicated forum.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘what is => s:21:"a:1:{i:0;s:4:"2276";}";’ is closed to new replies.