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
2145
2146      /**
2147       * Filters the media upload form action URL.
2148       *
2149       * @since 2.6.0
2150       *
2151       * @param string $form_action_url The media upload form action URL.
2152       * @param string $type            The type of media. Default 'file'.
2153       */
2154      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2155      $form_class      = 'media-upload-form type-form validate';
2156
2157      if ( get_user_setting( 'uploader' ) ) {
2158           $form_class .= ' html-uploader';
2159      }
2160      ?>
2161
2162 <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">
2163      <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2213           $type = 'image';
2214      }
2215
2216      media_upload_header();
2217
2218      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2219
2220      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2221      /** This filter is documented in wp-admin/includes/media.php */
2222      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2223      $form_class      = 'media-upload-form type-form validate';
2224
2225      if ( get_user_setting( 'uploader' ) ) {
2226           $form_class .= ' html-uploader';
2227      }
2228      ?>
2229
2230 <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">
2231 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2357 function media_upload_gallery_form( $errors ) {
2358      global $redir_tab, $type;
2359
2360      $redir_tab = 'gallery';
2361      media_upload_header();
2362
2363      $post_id         = intval( $_REQUEST['post_id'] );
2364      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2365      /** This filter is documented in wp-admin/includes/media.php */
2366      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2367      $form_class      = 'media-upload-form validate';
2368
2369      if ( get_user_setting( 'uploader' ) ) {
2370           $form_class .= ' html-uploader';
2371      }
2372      ?>
2373
2374 <script type="text/javascript">
2375 jQuery(function($){
 
Line Code
2521 function media_upload_library_form( $errors ) {
2522      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2523
2524      media_upload_header();
2525
2526      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2527
2528      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2529      /** This filter is documented in wp-admin/includes/media.php */
2530      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2531      $form_class      = 'media-upload-form validate';
2532
2533      if ( get_user_setting( 'uploader' ) ) {
2534           $form_class .= ' html-uploader';
2535      }
2536
2537      $q                   = $_GET;
2538      $q['posts_per_page'] = 10;
2539      $q['paged']          = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;