最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Get and Update Most Meta Value as an array in HTML form

programmeradmin0浏览0评论

I'm trying to update post meta for a meta edd_download_files the meta is in the form of an array. It is from a plugin so i can do it via admin, but still there is need to do it programmatically.

$simple_txt_fld = get_post_meta( $thispost->ID, 'edd_price', true );

echo print_r($simple_txt_fld);

I recieve the output like this

Array ( [index] => 0 [attachment_id] => 0 [thumbnail_size] => [name] => [file] => / [condition] => all ) 1

As I see it is an array, now i want to update the file name in the array. I created the form, and tried to update meta valued for other things, there it worked.

The code that i tried was this:

                    if ( array_key_exists('Download_File_Link', $input_values) )        {   
                            $a=$input_values['Download_File_Link'];
                                $array= Array(
                                 "index" => "0",
                                 "attachment_id"=> "0",
                                 "thumbnail_size" => "",
                                "name" => "",
                                 "file" => $a,
                                 "condition" => "all" );

                update_post_meta($postid, 'edd_download_files', $array  ); 

Here I am trying to put it in array and doesnt seem to work

It doesn't update file at all. Please help me out with a solution to update post meta in an array form

发布评论

评论列表(0)

  1. 暂无评论