Wordpress addmetabox

Dear friends

i have a custom meta box in wodpress product (woocommerce)

when wordpress save this in “wp_postmeta” table, save

meta_key =
wc_productdata_options

metavalue =

a:1:{i:0;a:6:{s:0:"";N;s:16:"_myselect_autore";a:6:{i:0;s:10:"option_609";i:1;s:11:"option_1416";i:2;s:10:"option_882";i:3;s:11:"option_1444";i:4;s:8:"option_5";i:5;s:10:"option_949";}s:17:"_myselect_collane";s:9:"option_91";s:14:"_mytext_pagine";s:3:"123";s:12:"_mytext_isbn";s:17:"978-88-96950-97-5";s:24:"_mytext_datapublicazione";s:10:"21/12/2016";}}

i have tried to create this value by wordpress function add_post_meta

$valori = array(
"_mytext_isbn" => "978-88-96950-97-5",
"_mytext_pagine" => "123",
"_myselect_collane" => "option_91",
"_mytext_datapublicazione" => "21/12/2016",

);
add_post_meta( 46, 'wc_productdata_options', $valori );

but wordpress save as:

a:1:{i:0;a:6:{s:0:"";N;s:16:"_myselect_autore";N;s:17:"_myselect_collane";s:10:"option_135";s:14:"_mytext_pagine";s:0:"";s:12:"_mytext_isbn";s:2:"12";s:24:"_mytext_datapublicazione";s:0:"";}}

how can modify add_post_meta to save the data how in first example?

thank you very much

That looks like the data has been serialised.

1 Like

you are great!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.