0

I have added one custom post in admin side for adding session details.Inside session post i want to add a speaker data by using dropdown box.but the data is stored in the post meta as "a:2:{i:0;s:2:"91";i:1;s:3:"105";}"

Here 91 and 105 are the ID's of speaker post.

Can anyone suggest me how can parse the data from the metadata.

Reshma
  • 189
  • 2
  • 5
  • 18

1 Answers1

0

You speaker metadata is in the serialized format. Just use get_post_meta( $session_id, '_speaker_meta_id', true ); you'll get the speaker data as an array and then you can do whatever you want. get_post_meta() automatically unserialize the serialized data.

For more details on get_post_meta() please check this https://developer.wordpress.org/reference/functions/get_post_meta/

obiPlabon
  • 603
  • 4
  • 10