Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_media_item_args

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
1120           $thumb_url = $thumb_url[0];
1121      else
1122           $thumb_url = false;
1123
1124      $post = get_post( $attachment_id );
1125      $current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
1126
1127      $default_args = array( 'errors' => null, 'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true );
1128      $args = wp_parse_args( $args, $default_args );
1129      $args = apply_filters( 'get_media_item_args', $args );
1130      extract( $args, EXTR_SKIP );
1131
1132      $toggle_on  = __( 'Show' );
1133      $toggle_off = __( 'Hide' );
1134
1135      $filename = esc_html( wp_basename( $post->guid ) );
1136      $title = esc_attr( $post->post_title );
1137
1138      if ( $_tags = get_the_tags( $attachment_id ) ) {
 
Line Code
1337
1338      $default_args = array(
1339           'errors' => null,
1340           'in_modal' => false,
1341      );
1342
1343      $user_can_edit = current_user_can( 'edit_post', $attachment_id );
1344
1345      $args = wp_parse_args( $args, $default_args );
1346      $args = apply_filters( 'get_media_item_args', $args );
1347
1348      $form_fields = array();
1349
1350      if ( $args['in_modal'] ) {
1351           foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1352                $t = (array) get_taxonomy($taxonomy);
1353                if ( ! $t['public'] || ! $t['show_ui'] )
1354                     continue;
1355                if ( empty($t['label']) )