WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
1174 | unset( $form_fields['menu_order'] ); |
1175 | break; |
1176 | } |
1177 | } |
1178 |
|
1179 | $media_dims = ''; |
1180 | $meta = wp_get_attachment_metadata( $post->ID ); |
1181 | if ( isset( $meta['width'], $meta['height'] ) ) |
1182 | $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; |
1183 | $media_dims = apply_filters( 'media_meta', $media_dims, $post ); |
1184 |
|
1185 | $image_edit_button = ''; |
1186 | if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { |
1187 | $nonce = wp_create_nonce( "image_editor-$post->ID" ); |
1188 | $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>"; |
1189 | } |
1190 |
|
1191 | $attachment_url = get_permalink( $attachment_id ); |
1192 |
|
Line | Code |
1376 | // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) |
1377 | $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] ); |
1378 |
|
1379 | $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); |
1380 |
|
1381 | unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], |
1382 | $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], |
1383 | $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); |
1384 |
|
1385 | $media_meta = apply_filters( 'media_meta', '', $post ); |
1386 |
|
1387 | $defaults = array( |
1388 | 'input' => 'text', |
1389 | 'required' => false, |
1390 | 'value' => '', |
1391 | 'extra_rows' => array(), |
1392 | 'show_in_edit' => true, |
1393 | 'show_in_modal' => true, |
1394 | ); |
Line | Code |
2424 | function attachment_submitbox_metadata() { |
2425 | $post = get_post(); |
2426 |
|
2427 | $filename = esc_html( wp_basename( $post->guid ) ); |
2428 |
|
2429 | $media_dims = ''; |
2430 | $meta = wp_get_attachment_metadata( $post->ID ); |
2431 | if ( isset( $meta['width'], $meta['height'] ) ) |
2432 | $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; |
2433 | $media_dims = apply_filters( 'media_meta', $media_dims, $post ); |
2434 |
|
2435 | $att_url = wp_get_attachment_url( $post->ID ); |
2436 | ?> |
2437 | <div class="misc-pub-section misc-pub-attachment"> |
2438 | <label for="attachment_url"><?php _e( 'File URL:' ); ?></label> |
2439 | <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" /> |
2440 | </div> |
2441 | <div class="misc-pub-section misc-pub-filename"> |
2442 | <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong> |