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 |
---|---|
1123 | unset( $form_fields['menu_order'] ); |
1124 | break; |
1125 | } |
1126 | } |
1127 |
|
1128 | $media_dims = ''; |
1129 | $meta = wp_get_attachment_metadata( $post->ID ); |
1130 | if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) ) |
1131 | $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; |
1132 | $media_dims = apply_filters( 'media_meta', $media_dims, $post ); |
1133 |
|
1134 | $image_edit_button = ''; |
1135 | if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) { |
1136 | $nonce = wp_create_nonce( "image_editor-$post->ID" ); |
1137 | $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>"; |
1138 | } |
1139 |
|
1140 | $attachment_url = get_permalink( $attachment_id ); |
1141 |
|
Line | Code |
1325 | // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing ) |
1326 | $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] ); |
1327 |
|
1328 | $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post ); |
1329 |
|
1330 | unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'], |
1331 | $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'], |
1332 | $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] ); |
1333 |
|
1334 | $media_meta = apply_filters( 'media_meta', '', $post ); |
1335 |
|
1336 | $defaults = array( |
1337 | 'input' => 'text', |
1338 | 'required' => false, |
1339 | 'value' => '', |
1340 | 'extra_rows' => array(), |
1341 | 'show_in_edit' => true, |
1342 | 'show_in_modal' => true, |
1343 | ); |
Line | Code |
2346 | function attachment_submitbox_metadata() { |
2347 | $post = get_post(); |
2348 |
|
2349 | $filename = esc_html( basename( $post->guid ) ); |
2350 |
|
2351 | $media_dims = ''; |
2352 | $meta = wp_get_attachment_metadata( $post->ID ); |
2353 | if ( is_array( $meta ) && array_key_exists( 'width', $meta ) && array_key_exists( 'height', $meta ) ) |
2354 | $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> "; |
2355 | $media_dims = apply_filters( 'media_meta', $media_dims, $post ); |
2356 |
|
2357 | $att_url = wp_get_attachment_url( $post->ID ); |
2358 | ?> |
2359 | <div class="misc-pub-section"> |
2360 | <label for="attachment_url"><?php _e( 'File URL:' ); ?></label> |
2361 | <input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" /> |
2362 | </div> |
2363 | <div class="misc-pub-section"> |
2364 | <?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong> |