mercredi 4 mars 2015

Can A Post Meta Field Store multiple values that are not in an array?


I have a post_meta field that seems to be displaying multiple values, yet they do not seem to be in an array. Using debug bar, this is what I see inside of the '_custom_post_type_onomies_relationship' meta field.


screenshot


I want to filter these id's to return titles instead. Because I am using Facet WP, I need the values to NOT be an array when done.



$item_array = get_post_meta( $post->id, '_custom_post_type_onomies_relationship' );
foreach ( $item_array as $item_id ) {
$title = get_the_title( $item_id );
$item_array[] = $title;
}

update_post_meta( $post->id, '_custom_post_type_onomies_relationship', $item_array );


This works just fine except that it is an array. What data type is that custom field before I filter it? How do I reproduce that data type?


Note: Before I filter it, the data type must not be an array because FacetWP can understand it.





Aucun commentaire:

Enregistrer un commentaire