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
1624
1625      /**
1626       * Filters the media metadata.
1627       *
1628       * @since 2.5.0
1629       *
1630       * @param string  $media_dims The HTML markup containing the media dimensions.
1631       * @param WP_Post $post       The WP_Post attachment object.
1632       */
1633      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
1634
1635      $image_edit_button = '';
1636
1637      if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
1638           $nonce             = wp_create_nonce( "image_editor-$post->ID" );
1639           $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>";
1640      }
1641
1642      $attachment_url = get_permalink( $attachment_id );
 
Line Code
1889           $form_fields['post_title'],
1890           $form_fields['post_excerpt'],
1891           $form_fields['post_content'],
1892           $form_fields['url'],
1893           $form_fields['menu_order'],
1894           $form_fields['image_url']
1895      );
1896
1897      /** This filter is documented in wp-admin/includes/media.php */
1898      $media_meta = apply_filters( 'media_meta', '', $post );
1899
1900      $defaults = array(
1901           'input'         => 'text',
1902           'required'      => false,
1903           'value'         => '',
1904           'extra_rows'    => array(),
1905           'show_in_edit'  => true,
1906           'show_in_modal' => true,
1907      );
 
Line Code
3235      $filename = esc_html( wp_basename( $file ) );
3236
3237      $media_dims = '';
3238      $meta       = wp_get_attachment_metadata( $attachment_id );
3239
3240      if ( isset( $meta['width'], $meta['height'] ) ) {
3241           $media_dims .= "<span id='media-dims-$attachment_id'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
3242      }
3243      /** This filter is documented in wp-admin/includes/media.php */
3244      $media_dims = apply_filters( 'media_meta', $media_dims, $post );
3245
3246      $att_url = wp_get_attachment_url( $attachment_id );
3247
3248      ?>
3249      <div class="misc-pub-section misc-pub-attachment">
3250           <label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
3251           <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr( $att_url ); ?>" />
3252      </div>
3253      <div class="misc-pub-section misc-pub-filename">