phpjsonwordpresspost-meta

how to fetch value from json formate wordpress


a:1:{s:9:"image_url";a:2:{i:0;s:62:"http://localhost/wordpress/wp-content/uploads/2021/04/g4-5.jpg";i:1;s:62:"http://localhost/wordpress/wp-content/uploads/2021/04/g1-2.jpg";}}

Above is my data. I am using WordPress and I retrieve those data from post meta table. Now I want to show images only. So I want to retrieve image path which is store in above as S:62. I don't know how I can retrieve. please help or guide me to solve my problem.


Solution

  • Use maybe_unserialize()

    $unserialize = maybe_unserialize( $serialize );