Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: attachment_fields_to_edit

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
1301
1302      /**
1303       * Filters the attachment fields to edit.
1304       *
1305       * @since 2.5.0
1306       *
1307       * @param array   $form_fields An array of attachment form fields.
1308       * @param WP_Post $post        The WP_Post attachment object.
1309       */
1310      $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1311
1312      return $form_fields;
1313 }
1314
1315 /**
1316  * Retrieve HTML for media items of post gallery.
1317  *
1318  * The HTML markup retrieved will be created for the progress of SWF Upload
1319  * component. Will also create link for showing and hiding the form to modify
 
Line Code
1661                $form_fields[$taxonomy] = $t;
1662           }
1663      }
1664
1665      // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
1666      // The recursive merge is easily traversed with array casting: foreach ( (array) $things as $thing )
1667      $form_fields = array_merge_recursive($form_fields, (array) $args['errors'] );
1668
1669      /** This filter is documented in wp-admin/includes/media.php */
1670      $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1671
1672      unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
1673           $form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
1674           $form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
1675
1676      /** This filter is documented in wp-admin/includes/media.php */
1677      $media_meta = apply_filters( 'media_meta', '', $post );
1678
1679      $defaults = array(