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