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
1069           $thumb_url = $thumb_url[0];
1070      else
1071           $thumb_url = false;
1072
1073      $post = get_post( $attachment_id );
1074      $current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
1075
1076      $default_args = array( 'errors' => null, 'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true, 'delete' => true, 'toggle' => true, 'show_title' => true );
1077      $args = wp_parse_args( $args, $default_args );
1078      $args = apply_filters( 'get_media_item_args', $args );
1079      extract( $args, EXTR_SKIP );
1080
1081      $toggle_on  = __( 'Show' );
1082      $toggle_off = __( 'Hide' );
1083
1084      $filename = esc_html( wp_basename( $post->guid ) );
1085      $title = esc_attr( $post->post_title );
1086
1087      if ( $_tags = get_the_tags( $attachment_id ) ) {
 
Line Code
1286
1287      $default_args = array(
1288           'errors' => null,
1289           'in_modal' => false,
1290      );
1291
1292      $user_can_edit = current_user_can( 'edit_post', $attachment_id );
1293
1294      $args = wp_parse_args( $args, $default_args );
1295      $args = apply_filters( 'get_media_item_args', $args );
1296
1297      $form_fields = array();
1298
1299      if ( $args['in_modal'] ) {
1300           foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1301                $t = (array) get_taxonomy($taxonomy);
1302                if ( ! $t['public'] || ! $t['show_ui'] )
1303                     continue;
1304                if ( empty($t['label']) )