• PHP Help
  • Help Getting Data from Serialized Options in Wordpress

I am getting serialized wordpress plugin data with a foreach loop. This is causing problems with other code within the loop. How can I get this data without a loop? I'm thinking there must be a better way. Is there?

This is the data.

a:2:{i:2;a:4:{s:5:"title";s:10:"My Title";s:4:"code";s:8:"12345";s:8:"template";s:21:"mytemplate";s:5:"cache";s:5:"86400";}s:12:"_multiwidget";i:1;}

This is the foreach code.

$values = get_option( 'widget_mywidget' );
foreach ($values as $value) {
$code = $value['code'];
$template = $value['template'];

    The PHP function for that is unserialize. How that helps you it's hard to say when the only description of symptoms is that it's "causing problems".

      Write a Reply...