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
2332
2333      /**
2334       * Filters the media upload form action URL.
2335       *
2336       * @since 2.6.0
2337       *
2338       * @param string $form_action_url The media upload form action URL.
2339       * @param string $type            The type of media. Default 'file'.
2340       */
2341      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2342      $form_class      = 'media-upload-form type-form validate';
2343
2344      if ( get_user_setting( 'uploader' ) ) {
2345           $form_class .= ' html-uploader';
2346      }
2347
2348      ?>
2349      <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">
2350           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2401           $type = 'image';
2402      }
2403
2404      media_upload_header();
2405
2406      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2407
2408      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2409      /** This filter is documented in wp-admin/includes/media.php */
2410      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2411      $form_class      = 'media-upload-form type-form validate';
2412
2413      if ( get_user_setting( 'uploader' ) ) {
2414           $form_class .= ' html-uploader';
2415      }
2416
2417      ?>
2418      <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">
2419      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2548 function media_upload_gallery_form( $errors ) {
2549      global $redir_tab, $type;
2550
2551      $redir_tab = 'gallery';
2552      media_upload_header();
2553
2554      $post_id         = (int) $_REQUEST['post_id'];
2555      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2556      /** This filter is documented in wp-admin/includes/media.php */
2557      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2558      $form_class      = 'media-upload-form validate';
2559
2560      if ( get_user_setting( 'uploader' ) ) {
2561           $form_class .= ' html-uploader';
2562      }
2563
2564      ?>
2565      <script type="text/javascript">
2566      jQuery(function($){
 
Line Code
2711 function media_upload_library_form( $errors ) {
2712      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2713
2714      media_upload_header();
2715
2716      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2717
2718      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2719      /** This filter is documented in wp-admin/includes/media.php */
2720      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2721      $form_class      = 'media-upload-form validate';
2722
2723      if ( get_user_setting( 'uploader' ) ) {
2724           $form_class .= ' html-uploader';
2725      }
2726
2727      $q                   = $_GET;
2728      $q['posts_per_page'] = 10;
2729      $q['paged']          = isset( $q['paged'] ) ? (int) $q['paged'] : 0;