Skip to content

Instantly share code, notes, and snippets.

@nickdavis
Last active December 16, 2016 14:06
Show Gist options
  • Save nickdavis/609558092a63c505e791cfb40663f00d to your computer and use it in GitHub Desktop.
Save nickdavis/609558092a63c505e791cfb40663f00d to your computer and use it in GitHub Desktop.
Unserialize array in PHP (from Advanced Custom Fields PRO, in this example)
<?php
/**
* Get one value from an serialized array example
*
* @link http://stackoverflow.com/questions/8192789/getting-one-value-out-of-a-serialized-array-in-php#8192803
*
* @author Nick Davis
*
* @return array
*/
function nd_unserialise_array_acf_example( $location ) {
$map = unserialize( get_term_meta( $location->term_id, 'ta_location_map', true ); );
return $map;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment