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
1443
1444      /**
1445       * Filters the media metadata.
1446       *
1447       * @since 2.5.0
1448       *
1449       * @param string  $media_dims The HTML markup containing the media dimensions.
1450       * @param WP_Post $post       The WP_Post attachment object.
1451       */
1452      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
1453
1454      $image_edit_button = '';
1455      if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
1456           $nonce = wp_create_nonce( "image_editor-$post->ID" );
1457           $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>";
1458      }
1459
1460      $attachment_url = get_permalink( $attachment_id );
1461
 
Line Code
1668
1669      /** This filter is documented in wp-admin/includes/media.php */
1670      $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1671
1672      unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
1673           $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
1674           $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
1675
1676      /** This filter is documented in wp-admin/includes/media.php */
1677      $media_meta = apply_filters( 'media_meta', '', $post );
1678
1679      $defaults = array(
1680           'input'         => 'text',
1681           'required'      => false,
1682           'value'         => '',
1683           'extra_rows'    => array(),
1684           'show_in_edit'  => true,
1685           'show_in_modal' => true,
1686      );
 
Line Code
2851
2852      $file = get_attached_file( $post->ID );
2853      $filename = esc_html( wp_basename( $file ) );
2854
2855      $media_dims = '';
2856      $meta = wp_get_attachment_metadata( $post->ID );
2857      if ( isset( $meta['width'], $meta['height'] ) )
2858           $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
2859      /** This filter is documented in wp-admin/includes/media.php */
2860      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
2861
2862      $att_url = wp_get_attachment_url( $post->ID );
2863 ?>
2864      <div class="misc-pub-section misc-pub-attachment">
2865           <label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
2866           <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr( $att_url ); ?>" />
2867      </div>
2868      <div class="misc-pub-section misc-pub-filename">
2869           <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>