[wp-trac] [WordPress Trac] #20853: get_post_custom show directly serialized data from the post_meta arrays.

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 6 05:39:24 UTC 2012


#20853: get_post_custom show directly serialized data from the post_meta arrays.
--------------------------+-----------------------------
 Reporter:  shadowhck     |      Owner:  Alan
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:  needs-patch
--------------------------+-----------------------------
 get_post_custom show directly serialized data from the post_meta arrays.
 For example:

 If I save a data with:

 {{{
                         update_post_meta(       $post_id,       'camp',
                                 array(
                                         'some'  =>      $var,
                                         'thing' =>      $var_2
                                 )
                         );
 }}}


 When I use get_post_meta(); :

 {{{
         $var_get = get_post_meta($post_id, 'camp', true);
         echo $var_get['some']; // Fine.. Print: $var content.
 }}}


 but, when I use get_post_custom() :

 {{{
         $var = get_post_custom($post_id);
         echo $var['some']; Metod, (Not work because "Returns a
 multidimensional array" with all values, and 0 is the first or the unique
 value).
         echo $var['some'][0]; /* Metod, >:( , Not work. Print:

 a:2:{i:some;s:4:"this";i:thing;s:7:"content";}  */
 }}}


 Instead of display "array", and can not handle sub arrays.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20853>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list