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