Custom field "Friend" displays as a:1:{i:0;s:6:"Friend";}
-
Website http://www.henleyprobate.org.uk uses wordpress 3.8.1 and plugin Advanced Custom Fields 3.5.0. I am aware that newer versions are available, but there were problems updating and it seems preferable to stick with versions that generally work well until the problems are understood.
The website stores C18th wills as custom posts. Post type ‘ewo’ has information about executors, witnesses and others associated with a will. The custom field ‘relationship’ holds the relationship if any with the testator. It all seems to work, but exceptionally, the relationship is displayed as a text string of the form a:1:{i:0;s:6:”Friend”;} when “Friend” should have been displayed. Deleting the ewo post in the dashboard and re-creating it seems to resolve the problem. But why?
The code that displays the relationship is' <?php $args = array( 'post_type' => 'ewo', 'post_status' => array('publish', 'draft', 'pending'), 'orderby' => 'ID', 'order' => 'ASC', 'nopaging' => 'true', 'meta_query' => array( array ( 'key' => 'will_id', 'value' => $will_id ) ) ); $query_others= new WP_Query($args); if ($query_others->have_posts()) { echo "<h2>Executors, Witnesses and Court Officials etc.</h2>"; ?><table><?php while($query_others->have_posts()) { $query_others->the_post(); $other_id = $query_others->post->ID; $custom_fields = get_post_custom($other_id); $role = $custom_fields['role']; $other_first_name = $custom_fields['first_name']; $other_last_name = $custom_fields['last_name']; $relationship = $custom_fields['relationship']; $additional_text = $custom_fields['additional_text']; ?> <tr> <td class="will-label"><?php echo $role[0] ?>: </td> <td class="will-field"><?php echo $other_first_name[0] . " " . $other_last_name[0] ?></td> </tr><?php if (!empty($relationship[0] )) { ?><tr><td class="will-label">Relationship: </td><td class="will-field"><?php echo $relationship[0] ?></td></tr><?php } if (!empty($additional_text[0] )) { ?><tr><td></td><td class ="will-additional"><?php echo " (" . $additional_text[0] . ")"; ?></td></tr><?php } } } ?><!-- end of if executor etc posts --> </table>'
Theproblem can be seen in the will of Samuel Bolton:
http://www.henleyprobate.org.uk/?will=samuel-boulton-27-june-1799
When this exceptional behaviour happens, it affects a few of the ewo posts for the one will.
- The topic ‘Custom field "Friend" displays as a:1:{i:0;s:6:"Friend";}’ is closed to new replies.