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