Convert comma separated list to serialized array to import as post meta
If you need to do this conversion in PHP, as part of whatever import process, then you can just convert the comma-separated values into an array with explode(), and then use update_post_meta(), which will automatically serialise the value for you: $value=”Morning,Daytime”; $array = explode( ‘,’, $value ); update_post_meta( $post_id, ‘hours_of_operation’, $array ); Use trim() if … Read more