Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: media_meta

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 3 times in this file.

Line Code
1173                unset( $form_fields['menu_order'] );
1174                break;
1175           }
1176      }
1177
1178      $media_dims = '';
1179      $meta = wp_get_attachment_metadata( $post->ID );
1180      if ( isset( $meta['width'], $meta['height'] ) )
1181           $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
1182      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
1183
1184      $image_edit_button = '';
1185      if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
1186           $nonce = wp_create_nonce( "image_editor-$post->ID" );
1187           $image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
1188      }
1189
1190      $attachment_url = get_permalink( $attachment_id );
1191
 
Line Code
1375      // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
1376      $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] );
1377
1378      $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1379
1380      unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
1381           $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
1382           $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
1383
1384      $media_meta = apply_filters( 'media_meta', '', $post );
1385
1386      $defaults = array(
1387           'input'         => 'text',
1388            'required'      => false,
1389            'value'         => '',
1390            'extra_rows'    => array(),
1391            'show_in_edit'  => true,
1392            'show_in_modal' => true,
1393      );
 
Line Code
2422 function attachment_submitbox_metadata() {
2423      $post = get_post();
2424
2425      $filename = esc_html( wp_basename( $post->guid ) );
2426
2427      $media_dims = '';
2428      $meta = wp_get_attachment_metadata( $post->ID );
2429      if ( isset( $meta['width'], $meta['height'] ) )
2430           $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
2431      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
2432
2433      $att_url = wp_get_attachment_url( $post->ID );
2434 ?>
2435      <div class="misc-pub-section">
2436                <label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
2437                <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" />
2438      </div>
2439      <div class="misc-pub-section">
2440           <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>