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
1119           $thumb_url = $thumb_url[0];
1120      else
1121           $thumb_url = false;
1122
1123      $post = get_post( $attachment_id );
1124      $current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
1125
1126      $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 );
1127      $args = wp_parse_args( $args, $default_args );
1128      $args = apply_filters( 'get_media_item_args', $args );
1129      extract( $args, EXTR_SKIP );
1130
1131      $toggle_on  = __( 'Show' );
1132      $toggle_off = __( 'Hide' );
1133
1134      $filename = esc_html( wp_basename( $post->guid ) );
1135      $title = esc_attr( $post->post_title );
1136
1137      if ( $_tags = get_the_tags( $attachment_id ) ) {
 
Line Code
1336
1337      $default_args = array(
1338           'errors' => null,
1339           'in_modal' => false,
1340      );
1341
1342      $user_can_edit = current_user_can( 'edit_post', $attachment_id );
1343
1344      $args = wp_parse_args( $args, $default_args );
1345      $args = apply_filters( 'get_media_item_args', $args );
1346
1347      $form_fields = array();
1348
1349      if ( $args['in_modal'] ) {
1350           foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1351                $t = (array) get_taxonomy($taxonomy);
1352                if ( ! $t['public'] || ! $t['show_ui'] )
1353                     continue;
1354                if ( empty($t['label']) )