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