[wp-trac] [WordPress Trac] #22664: attachment_fields_to_edit: parameter missing indexes (was: attachment_fields_to_save: parameter missing indexes)

WordPress Trac noreply at wordpress.org
Sun Dec 2 22:27:25 UTC 2012


#22664: attachment_fields_to_edit: 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 reporter-feedback  |
-------------------------------------------+------------------------------

Comment (by ZaneMatthew):

 Sorry for the confusion, the issue is actually with the hook
 "attachment_fields_to_edit", because this hook
 "attachment_fields_to_save", is not even fired or in use anymore (from
 what I can see). The hook "attachment_fields_to_save" was fired after
 you've uploaded an Attachment using the "Add New" Media form, a "Save All
 Changes" button was present, it has hence been removed.

 That being said I've updated the Ticket title.

 To address the issue of not passing in the number of parameters, you are
 correct that my snippet was wrong (it also throws a PHP Warning),
 regardless that does not fix the issue of the $attachments array no longer
 containing the correct indexes.

 Note the contents of the $attachments Array is as followed (for Stable
 release):
  Array
  (
     [menu_order] => 0
     [post_title] => background
     [image_alt] =>
     [post_excerpt] =>
     [post_content] =>
     [url] => http://gpp.dev/wp-content/uploads/2012/12/background1.jpg
  )

 Granted I can adjust my code to be "combatible" if WordPress 3.5 will no
 longer contain this $attachments array.

 Note you can just add the following code to your functions.php, or make a
 plugins.php, and proceed to edit an attachment, noting the differences
 between Stable and 3.5RC2
  function my_func( $post, $attachment ){
     print '<pre>';
     print_r( $post );
     print_r( $attachment );
     print '</pre>';
     die();
  }
  add_action( 'attachment_fields_to_edit', 'my_func', 10, 2 );

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


More information about the wp-trac mailing list