Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#22664 closed defect (bug)

attachment_fields_to_save: parameter missing indexes — at Version 2

Reported by: ZaneMatthew Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords:
Focuses: Cc:

Description (last modified by ocean90)

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>'; 
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] =>

Change History (2)

#1 @helenyhou
3 years ago

What issues does this cause? post_title, image_alt, post_excerpt, and post_content are all handled differently now, so it makes sense that they no longer show in the array. Not sure about the rest.

#2 @ocean90
3 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.