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
1929
1930      /**
1931       * Filter the media upload form action URL.
1932       *
1933       * @since 2.6.0
1934       *
1935       * @param string $form_action_url The media upload form action URL.
1936       * @param string $type            The type of media. Default 'file'.
1937       */
1938      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
1939      $form_class = 'media-upload-form type-form validate';
1940
1941      if ( get_user_setting('uploader') )
1942           $form_class .= ' html-uploader';
1943 ?>
1944
1945 <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">
1946 <?php submit_button( '', 'hidden', 'save', false ); ?>
1947 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
1993      if ( null === $type )
1994           $type = 'image';
1995
1996      media_upload_header();
1997
1998      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
1999
2000      $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
2001      /** This filter is documented in wp-admin/includes/media.php */
2002      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2003      $form_class = 'media-upload-form type-form validate';
2004
2005      if ( get_user_setting('uploader') )
2006           $form_class .= ' html-uploader';
2007 ?>
2008
2009 <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">
2010 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2011 <?php wp_nonce_field('media-form'); ?>
 
Line Code
2132 function media_upload_gallery_form($errors) {
2133      global $redir_tab, $type;
2134
2135      $redir_tab = 'gallery';
2136      media_upload_header();
2137
2138      $post_id = intval($_REQUEST['post_id']);
2139      $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
2140      /** This filter is documented in wp-admin/includes/media.php */
2141      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2142      $form_class = 'media-upload-form validate';
2143
2144      if ( get_user_setting('uploader') )
2145           $form_class .= ' html-uploader';
2146 ?>
2147
2148 <script type="text/javascript">
2149 jQuery(function($){
2150      var preloaded = $(".media-item.preloaded");
 
Line Code
2277 function media_upload_library_form($errors) {
2278      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2279
2280      media_upload_header();
2281
2282      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2283
2284      $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
2285      /** This filter is documented in wp-admin/includes/media.php */
2286      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2287      $form_class = 'media-upload-form validate';
2288
2289      if ( get_user_setting('uploader') )
2290           $form_class .= ' html-uploader';
2291
2292      $q = $_GET;
2293      $q['posts_per_page'] = 10;
2294      $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
2295      if ( $q['paged'] < 1 ) {