[wp-trac] [WordPress Trac] #22664: attachment_fields_to_save: parameter missing indexes

WordPress Trac noreply at wordpress.org
Sat Dec 1 00:02:23 UTC 2012


#22664: attachment_fields_to_save: parameter missing indexes
--------------------------+------------------------------
 Reporter:  ZaneMatthew   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------
Description changed by ocean90:

Old description:

> When using the hook "attachment_fields_to_save " the second parameter
> ($attachments) no longer has the same indexes at it does on WordPress'
> stable release.
>
> You can reproduce with the following, make a plugin and drop this in then
> upload an attachment and click "save".
>
>  function my_func( $post, $attachment ){
>    print '<pre>';
>    print_r( $attachment );
>    print '</pre>';
>    die();
> }
> add_action('attachment_fields_to_save', 'my_func');
>

> Stable WordPress produces this:
> Array (
>   [menu_order] => 0
>   [post_title] =>
>   [image_alt] =>
>   [post_excerpt] =>
>   [post_content] =>
>   [url] =>
> )

New description:

 When using the hook "attachment_fields_to_save " the second parameter
 ($attachments) no longer has the same indexes at it does on WordPress'
 stable release.

 You can reproduce with the following, make a plugin and drop this in then
 upload an attachment and click "save".


 {{{
  function my_func( $post, $attachment ){
    print '<pre>';
    print_r( $attachment );
    print '</pre>';
    die();
 }
 add_action('attachment_fields_to_save', 'my_func');
 }}}



 Stable WordPress produces this:

 {{{
 Array (
   [menu_order] => 0
   [post_title] =>
   [image_alt] =>
   [post_excerpt] =>
   [post_content] =>
   [url] =>
 )
 }}}

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22664#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list