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
1657
1658      /**
1659       * Filters the media metadata.
1660       *
1661       * @since 2.5.0
1662       *
1663       * @param string  $media_dims The HTML markup containing the media dimensions.
1664       * @param WP_Post $post       The WP_Post attachment object.
1665       */
1666      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
1667
1668      $image_edit_button = '';
1669
1670      if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
1671           $nonce             = wp_create_nonce( "image_editor-$post->ID" );
1672           $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>";
1673      }
1674
1675      $attachment_url = get_permalink( $attachment_id );
 
Line Code
1929           $form_fields['post_title'],
1930           $form_fields['post_excerpt'],
1931           $form_fields['post_content'],
1932           $form_fields['url'],
1933           $form_fields['menu_order'],
1934           $form_fields['image_url']
1935      );
1936
1937      /** This filter is documented in wp-admin/includes/media.php */
1938      $media_meta = apply_filters( 'media_meta', '', $post );
1939
1940      $defaults = array(
1941           'input'         => 'text',
1942           'required'      => false,
1943           'value'         => '',
1944           'extra_rows'    => array(),
1945           'show_in_edit'  => true,
1946           'show_in_modal' => true,
1947      );
 
Line Code
3278      $filename = esc_html( wp_basename( $file ) );
3279
3280      $media_dims = '';
3281      $meta       = wp_get_attachment_metadata( $attachment_id );
3282
3283      if ( isset( $meta['width'], $meta['height'] ) ) {
3284           $media_dims .= "<span id='media-dims-$attachment_id'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
3285      }
3286      /** This filter is documented in wp-admin/includes/media.php */
3287      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
3288
3289      $att_url = wp_get_attachment_url( $attachment_id );
3290
3291      $author = get_userdata( $post->post_author );
3292
3293      $uploaded_by_name = __( '(no author)' );
3294      $uploaded_by_link = '';
3295      if ( $author->exists() ) {
3296           $uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname;