Instead of rubber ducking, I’m writing it out here…

I’m trying to modify @benbalter’s WordPress Jekyll Export plugin to extract serialzed data from post_meta values. It seems most (all?) of the IndieWeb WordPress plugins use serialized values so it’s necessary to migrate. Otherwise I wind up with YAML that looks like this

mf2_syndication:
  - 'a:1:{i:0;s:52:"https://twitter.com/miklb/status/1116855596970651650";}'
geo_weather:
  - 'a:2:{s:4:"icon";s:4:"none";s:10:"visibility";s:6:"public";}

The chunk of code that handles that

// Convert traditional post_meta values, hide hidden values.
        foreach ( get_post_custom( $post->ID ) as $key => $value ) {

            if ( substr( $key, 0, 1 ) === '_' ) {
                continue;
            }

            $output[ $key ] = $value;

        }

What I need to do is unserialize $value and if it’s an array, loop through them and nest the values for each $key.

to get something like

mf2_syndication: https://twitter.com/miklb/status/1116855596970651650

geo_weather:
    - icon: none
       visibility: public

But my first step is to unravel the serialized $value. I’ve tried just adding $output[ $key ] = maybe_unserialize ($value ); and that didn’t work like the magic bullet I’d hoped.

🤔

Ok. that was the last test. I give up on posting images via Micropub on WordPress. I’ll be moved by morning. This domain will probably go dormant while I move, then still not sure if I’ll continue to blog here. 🤔 I’ll make sure to post a new feed link for the one or two who may be following that way.