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
2266
2267      /**
2268       * Filters the media upload form action URL.
2269       *
2270       * @since 2.6.0
2271       *
2272       * @param string $form_action_url The media upload form action URL.
2273       * @param string $type            The type of media. Default 'file'.
2274       */
2275      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2276      $form_class      = 'media-upload-form type-form validate';
2277
2278      if ( get_user_setting( 'uploader' ) ) {
2279           $form_class .= ' html-uploader';
2280      }
2281
2282      ?>
2283      <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">
2284           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2335           $type = 'image';
2336      }
2337
2338      media_upload_header();
2339
2340      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2341
2342      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2343      /** This filter is documented in wp-admin/includes/media.php */
2344      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2345      $form_class      = 'media-upload-form type-form validate';
2346
2347      if ( get_user_setting( 'uploader' ) ) {
2348           $form_class .= ' html-uploader';
2349      }
2350
2351      ?>
2352      <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">
2353      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2482 function media_upload_gallery_form( $errors ) {
2483      global $redir_tab, $type;
2484
2485      $redir_tab = 'gallery';
2486      media_upload_header();
2487
2488      $post_id         = intval( $_REQUEST['post_id'] );
2489      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2490      /** This filter is documented in wp-admin/includes/media.php */
2491      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2492      $form_class      = 'media-upload-form validate';
2493
2494      if ( get_user_setting( 'uploader' ) ) {
2495           $form_class .= ' html-uploader';
2496      }
2497
2498      ?>
2499      <script type="text/javascript">
2500      jQuery(function($){
 
Line Code
2646 function media_upload_library_form( $errors ) {
2647      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2648
2649      media_upload_header();
2650
2651      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2652
2653      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2654      /** This filter is documented in wp-admin/includes/media.php */
2655      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2656      $form_class      = 'media-upload-form validate';
2657
2658      if ( get_user_setting( 'uploader' ) ) {
2659           $form_class .= ' html-uploader';
2660      }
2661
2662      $q                   = $_GET;
2663      $q['posts_per_page'] = 10;
2664      $q['paged']          = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;