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
1986
1987      /**
1988       * Filter the media upload form action URL.
1989       *
1990       * @since 2.6.0
1991       *
1992       * @param string $form_action_url The media upload form action URL.
1993       * @param string $type            The type of media. Default 'file'.
1994       */
1995      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
1996      $form_class = 'media-upload-form type-form validate';
1997
1998      if ( get_user_setting('uploader') )
1999           $form_class .= ' html-uploader';
2000 ?>
2001
2002 <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">
2003 <?php submit_button( '', 'hidden', 'save', false ); ?>
2004 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2050      if ( null === $type )
2051           $type = 'image';
2052
2053      media_upload_header();
2054
2055      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2056
2057      $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
2058      /** This filter is documented in wp-admin/includes/media.php */
2059      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2060      $form_class = 'media-upload-form type-form validate';
2061
2062      if ( get_user_setting('uploader') )
2063           $form_class .= ' html-uploader';
2064 ?>
2065
2066 <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">
2067 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2068 <?php wp_nonce_field('media-form'); ?>
 
Line Code
2193 function media_upload_gallery_form($errors) {
2194      global $redir_tab, $type;
2195
2196      $redir_tab = 'gallery';
2197      media_upload_header();
2198
2199      $post_id = intval($_REQUEST['post_id']);
2200      $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
2201      /** This filter is documented in wp-admin/includes/media.php */
2202      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2203      $form_class = 'media-upload-form validate';
2204
2205      if ( get_user_setting('uploader') )
2206           $form_class .= ' html-uploader';
2207 ?>
2208
2209 <script type="text/javascript">
2210 jQuery(function($){
2211      var preloaded = $(".media-item.preloaded");
 
Line Code
2345 function media_upload_library_form($errors) {
2346      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2347
2348      media_upload_header();
2349
2350      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2351
2352      $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
2353      /** This filter is documented in wp-admin/includes/media.php */
2354      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2355      $form_class = 'media-upload-form validate';
2356
2357      if ( get_user_setting('uploader') )
2358           $form_class .= ' html-uploader';
2359
2360      $q = $_GET;
2361      $q['posts_per_page'] = 10;
2362      $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
2363      if ( $q['paged'] < 1 ) {