Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: media_upload_form_url

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 4 times in this file.

Line Code
1975
1976      /**
1977       * Filter the media upload form action URL.
1978       *
1979       * @since 2.6.0
1980       *
1981       * @param string $form_action_url The media upload form action URL.
1982       * @param string $type            The type of media. Default 'file'.
1983       */
1984      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
1985      $form_class = 'media-upload-form type-form validate';
1986
1987      if ( get_user_setting('uploader') )
1988           $form_class .= ' html-uploader';
1989 ?>
1990
1991 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
1992 <?php submit_button( '', 'hidden', 'save', false ); ?>
1993 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2039      if ( null === $type )
2040           $type = 'image';
2041
2042      media_upload_header();
2043
2044      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2045
2046      $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
2047      /** This filter is documented in wp-admin/includes/media.php */
2048      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2049      $form_class = 'media-upload-form type-form validate';
2050
2051      if ( get_user_setting('uploader') )
2052           $form_class .= ' html-uploader';
2053 ?>
2054
2055 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
2056 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2057 <?php wp_nonce_field('media-form'); ?>
 
Line Code
2182 function media_upload_gallery_form($errors) {
2183      global $redir_tab, $type;
2184
2185      $redir_tab = 'gallery';
2186      media_upload_header();
2187
2188      $post_id = intval($_REQUEST['post_id']);
2189      $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
2190      /** This filter is documented in wp-admin/includes/media.php */
2191      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2192      $form_class = 'media-upload-form validate';
2193
2194      if ( get_user_setting('uploader') )
2195           $form_class .= ' html-uploader';
2196 ?>
2197
2198 <script type="text/javascript">
2199 jQuery(function($){
2200      var preloaded = $(".media-item.preloaded");
 
Line Code
2334 function media_upload_library_form($errors) {
2335      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2336
2337      media_upload_header();
2338
2339      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2340
2341      $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
2342      /** This filter is documented in wp-admin/includes/media.php */
2343      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2344      $form_class = 'media-upload-form validate';
2345
2346      if ( get_user_setting('uploader') )
2347           $form_class .= ' html-uploader';
2348
2349      $q = $_GET;
2350      $q['posts_per_page'] = 10;
2351      $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
2352      if ( $q['paged'] < 1 ) {