[wp-trac] [WordPress Trac] #23148: Add hook in wp_ajax_save_attachment for additional attachment fields

WordPress Trac noreply at wordpress.org
Fri Feb 15 21:56:58 UTC 2013


#23148: Add hook in wp_ajax_save_attachment for additional attachment fields
-------------------------+------------------
 Reporter:  griffinjt    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  3.6
Component:  Media        |     Version:  3.5
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------

Comment (by bradyvercher):

 No worries and good point on context-sensitive fields. In that case, data
 in the `$_REQUEST` global is available to every action fired during the
 request, so `edit_attachment` should eventually get called and work fine
 for your purposes:

 {{{
 function soliloquy_save_attachment_fields( $attachment_id ) {
         if ( defined( 'DOING_AJAX' ) && DOING_AJAX && ! empty(
 $_REQUEST['changes']['soliloquy_link'] ) )
                 update_post_meta( $attachment_id, '_soliloquy_image_link',
 esc_url_raw( $_REQUEST['changes']['soliloquy_link'] ) );
 }
 add_action( 'edit_attachment', 'soliloquy_save_attachment_fields' );
 }}}

 Would something like that work?

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


More information about the wp-trac mailing list