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
2002
2003      /**
2004       * Filters the media upload form action URL.
2005       *
2006       * @since 2.6.0
2007       *
2008       * @param string $form_action_url The media upload form action URL.
2009       * @param string $type            The type of media. Default 'file'.
2010       */
2011      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2012      $form_class = 'media-upload-form type-form validate';
2013
2014      if ( get_user_setting('uploader') )
2015           $form_class .= ' html-uploader';
2016 ?>
2017
2018 <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">
2019 <?php submit_button( '', 'hidden', 'save', false ); ?>
2020 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2066      if ( null === $type )
2067           $type = 'image';
2068
2069      media_upload_header();
2070
2071      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2072
2073      $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
2074      /** This filter is documented in wp-admin/includes/media.php */
2075      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2076      $form_class = 'media-upload-form type-form validate';
2077
2078      if ( get_user_setting('uploader') )
2079           $form_class .= ' html-uploader';
2080 ?>
2081
2082 <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">
2083 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2084 <?php wp_nonce_field('media-form'); ?>
 
Line Code
2209 function media_upload_gallery_form($errors) {
2210      global $redir_tab, $type;
2211
2212      $redir_tab = 'gallery';
2213      media_upload_header();
2214
2215      $post_id = intval($_REQUEST['post_id']);
2216      $form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
2217      /** This filter is documented in wp-admin/includes/media.php */
2218      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2219      $form_class = 'media-upload-form validate';
2220
2221      if ( get_user_setting('uploader') )
2222           $form_class .= ' html-uploader';
2223 ?>
2224
2225 <script type="text/javascript">
2226 jQuery(function($){
2227      var preloaded = $(".media-item.preloaded");
 
Line Code
2361 function media_upload_library_form($errors) {
2362      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2363
2364      media_upload_header();
2365
2366      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2367
2368      $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
2369      /** This filter is documented in wp-admin/includes/media.php */
2370      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2371      $form_class = 'media-upload-form validate';
2372
2373      if ( get_user_setting('uploader') )
2374           $form_class .= ' html-uploader';
2375
2376      $q = $_GET;
2377      $q['posts_per_page'] = 10;
2378      $q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
2379      if ( $q['paged'] < 1 ) {