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
1960
1961      /**
1962       * Filter the media upload form action URL.
1963       *
1964       * @since 2.6.0
1965       *
1966       * @param string $form_action_url The media upload form action URL.
1967       * @param string $type            The type of media. Default 'file'.
1968       */
1969      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
1970      $form_class = 'media-upload-form type-form validate';
1971
1972      if ( get_user_setting('uploader') )
1973           $form_class .= ' html-uploader';
1974 ?>
1975
1976 <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">
1977 <?php submit_button( '', 'hidden', 'save', false ); ?>
1978 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2024      if ( null === $type )
2025           $type = 'image';
2026
2027      media_upload_header();
2028
2029      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2030
2031      $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
2032      /** This filter is documented in wp-admin/includes/media.php */
2033      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2034      $form_class = 'media-upload-form type-form validate';
2035
2036      if ( get_user_setting('uploader') )
2037           $form_class .= ' html-uploader';
2038 ?>
2039
2040 <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">
2041 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2042 <?php wp_nonce_field('media-form'); ?>
 
Line Code
2167 function media_upload_gallery_form($errors) {
2168      global $redir_tab, $type;
2169
2170      $redir_tab = 'gallery';
2171      media_upload_header();
2172
2173      $post_id = intval($_REQUEST['post_id']);
2174      $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
2175      /** This filter is documented in wp-admin/includes/media.php */
2176      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2177      $form_class = 'media-upload-form validate';
2178
2179      if ( get_user_setting('uploader') )
2180           $form_class .= ' html-uploader';
2181 ?>
2182
2183 <script type="text/javascript">
2184 jQuery(function($){
2185      var preloaded = $(".media-item.preloaded");
 
Line Code
2319 function media_upload_library_form($errors) {
2320      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2321
2322      media_upload_header();
2323
2324      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2325
2326      $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
2327      /** This filter is documented in wp-admin/includes/media.php */
2328      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2329      $form_class = 'media-upload-form validate';
2330
2331      if ( get_user_setting('uploader') )
2332           $form_class .= ' html-uploader';
2333
2334      $q = $_GET;
2335      $q['posts_per_page'] = 10;
2336      $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
2337      if ( $q['paged'] < 1 ) {