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
1333      /**
1334       * Filter the arguments used to retrieve an image for the edit image form.
1335       *
1336       * @since 3.1.0
1337       *
1338       * @see get_media_item
1339       *
1340       * @param array $args An array of arguments.
1341       */
1342      $r = apply_filters( 'get_media_item_args', $args );
1343
1344      $toggle_on  = __( 'Show' );
1345      $toggle_off = __( 'Hide' );
1346
1347      $filename = esc_html( wp_basename( $post->guid ) );
1348      $title = esc_attr( $post->post_title );
1349
1350      $post_mime_types = get_post_mime_types();
1351      $keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
 
Line Code
1558           'errors' => null,
1559           'in_modal' => false,
1560      );
1561
1562      $user_can_edit = current_user_can( 'edit_post', $attachment_id );
1563
1564      $args = wp_parse_args( $args, $default_args );
1565
1566      /** This filter is documented in wp-admin/includes/media.php */
1567      $args = apply_filters( 'get_media_item_args', $args );
1568
1569      $form_fields = array();
1570
1571      if ( $args['in_modal'] ) {
1572           foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1573                $t = (array) get_taxonomy($taxonomy);
1574                if ( ! $t['public'] || ! $t['show_ui'] )
1575                     continue;
1576                if ( empty($t['label']) )