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
1373      /**
1374       * Filters the arguments used to retrieve an image for the edit image form.
1375       *
1376       * @since 3.1.0
1377       *
1378       * @see get_media_item
1379       *
1380       * @param array $args An array of arguments.
1381       */
1382      $r = apply_filters( 'get_media_item_args', $args );
1383
1384      $toggle_on  = __( 'Show' );
1385      $toggle_off = __( 'Hide' );
1386
1387      $file = get_attached_file( $post->ID );
1388      $filename = esc_html( wp_basename( $file ) );
1389      $title = esc_attr( $post->post_title );
1390
1391      $post_mime_types = get_post_mime_types();
 
Line Code
1614           'errors' => null,
1615           'in_modal' => false,
1616      );
1617
1618      $user_can_edit = current_user_can( 'edit_post', $attachment_id );
1619
1620      $args = wp_parse_args( $args, $default_args );
1621
1622      /** This filter is documented in wp-admin/includes/media.php */
1623      $args = apply_filters( 'get_media_item_args', $args );
1624
1625      $form_fields = array();
1626
1627      if ( $args['in_modal'] ) {
1628           foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1629                $t = (array) get_taxonomy($taxonomy);
1630                if ( ! $t['public'] || ! $t['show_ui'] )
1631                     continue;
1632                if ( empty($t['label']) )