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
1455
1456      /**
1457       * Filters the attachment fields to edit.
1458       *
1459       * @since 2.5.0
1460       *
1461       * @param array   $form_fields An array of attachment form fields.
1462       * @param WP_Post $post        The WP_Post attachment object.
1463       */
1464      $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1465
1466      return $form_fields;
1467 }
1468
1469 /**
1470  * Retrieve HTML for media items of post gallery.
1471  *
1472  * The HTML markup retrieved will be created for the progress of SWF Upload
1473  * component. Will also create link for showing and hiding the form to modify
 
Line Code
1874                $form_fields[ $taxonomy ] = $t;
1875           }
1876      }
1877
1878      // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
1879      // The recursive merge is easily traversed with array casting: foreach ( (array) $things as $thing )
1880      $form_fields = array_merge_recursive( $form_fields, (array) $args['errors'] );
1881
1882      /** This filter is documented in wp-admin/includes/media.php */
1883      $form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1884
1885      unset(
1886           $form_fields['image-size'],
1887           $form_fields['align'],
1888           $form_fields['image_alt'],
1889           $form_fields['post_title'],
1890           $form_fields['post_excerpt'],
1891           $form_fields['post_content'],
1892           $form_fields['url'],