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
1608      /**
1609       * Filters the arguments used to retrieve an image for the edit image form.
1610       *
1611       * @since 3.1.0
1612       *
1613       * @see get_media_item
1614       *
1615       * @param array $parsed_args An array of arguments.
1616       */
1617      $parsed_args = apply_filters( 'get_media_item_args', $parsed_args );
1618
1619      $toggle_on  = __( 'Show' );
1620      $toggle_off = __( 'Hide' );
1621
1622      $file     = get_attached_file( $post->ID );
1623      $filename = esc_html( wp_basename( $file ) );
1624      $title    = esc_attr( $post->post_title );
1625
1626      $post_mime_types = get_post_mime_types();
 
Line Code
1877           'errors'   => null,
1878           'in_modal' => false,
1879      );
1880
1881      $user_can_edit = current_user_can( 'edit_post', $attachment_id );
1882
1883      $args = wp_parse_args( $args, $default_args );
1884
1885      /** This filter is documented in wp-admin/includes/media.php */
1886      $args = apply_filters( 'get_media_item_args', $args );
1887
1888      $form_fields = array();
1889
1890      if ( $args['in_modal'] ) {
1891           foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {
1892                $t = (array) get_taxonomy( $taxonomy );
1893
1894                if ( ! $t['public'] || ! $t['show_ui'] ) {
1895                     continue;