[wp-trac] [WordPress Trac] #37627: Custom Fields Heading shows up when all meta values are serialized arrays/objects

WordPress Trac noreply at wordpress.org
Thu Aug 11 17:44:33 UTC 2016


#37627: Custom Fields Heading shows up when all meta values are serialized
arrays/objects
----------------------------+---------------------------------
 Reporter:  implenton       |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  ui, administration
----------------------------+---------------------------------
Description changed by SergeyBiryukov:

Old description:

> `_list_meta_row` skips the meta rows when the value is a serialized
> array/objects.
>
> When all meta values are serialized arrays/objects OR when you only have
> one meta with the value being serialized array/object the table heading
> shows up:
>
> [[Image(https://cldup.com/sVKAp24YMF.png)]]
>
> [[Image(https://cldup.com/0axQNTon98.png)]]
>
> There is a check for protected metas before the table rendering
>
> wp-admin/includes/meta-boxes.php:631
>
> {{{
> $metadata = has_meta($post->ID);
> foreach ( $metadata as $key => $value ) {
>         if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' )
> || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][
> 'meta_key' ] ) )
>                 unset( $metadata[ $key ] );
> }
> list_meta( $metadata );
> }}}
>
> but it does not take in account meta values, which are skipped later.
>
> ''This might be considered an edge case, but it is better to be noted.''
>
> Discovered this when I reported:
> https://core.trac.wordpress.org/ticket/37626

New description:

 `_list_meta_row` skips the meta rows when the value is a serialized
 array/objects.

 When all meta values are serialized arrays/objects OR when you only have
 one meta with the value being serialized array/object the table heading
 shows up:

 [[Image(https://cldup.com/sVKAp24YMF.png)]]

 [[Image(https://cldup.com/0axQNTon98.png)]]

 There is a check for protected metas before the table rendering

 wp-admin/includes/meta-boxes.php:631

 {{{
 $metadata = has_meta($post->ID);
 foreach ( $metadata as $key => $value ) {
         if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' )
 || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][
 'meta_key' ] ) )
                 unset( $metadata[ $key ] );
 }
 list_meta( $metadata );
 }}}

 but it does not take in account meta values, which are skipped later.

 ''This might be considered an edge case, but it is better to be noted.''

 Discovered this when I reported: #37626

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37627#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list