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
2309
2310      /**
2311       * Filters the media upload form action URL.
2312       *
2313       * @since 2.6.0
2314       *
2315       * @param string $form_action_url The media upload form action URL.
2316       * @param string $type            The type of media. Default 'file'.
2317       */
2318      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2319      $form_class      = 'media-upload-form type-form validate';
2320
2321      if ( get_user_setting( 'uploader' ) ) {
2322           $form_class .= ' html-uploader';
2323      }
2324
2325      ?>
2326      <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">
2327           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2378           $type = 'image';
2379      }
2380
2381      media_upload_header();
2382
2383      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2384
2385      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2386      /** This filter is documented in wp-admin/includes/media.php */
2387      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2388      $form_class      = 'media-upload-form type-form validate';
2389
2390      if ( get_user_setting( 'uploader' ) ) {
2391           $form_class .= ' html-uploader';
2392      }
2393
2394      ?>
2395      <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">
2396      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2525 function media_upload_gallery_form( $errors ) {
2526      global $redir_tab, $type;
2527
2528      $redir_tab = 'gallery';
2529      media_upload_header();
2530
2531      $post_id         = (int) $_REQUEST['post_id'];
2532      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2533      /** This filter is documented in wp-admin/includes/media.php */
2534      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2535      $form_class      = 'media-upload-form validate';
2536
2537      if ( get_user_setting( 'uploader' ) ) {
2538           $form_class .= ' html-uploader';
2539      }
2540
2541      ?>
2542      <script type="text/javascript">
2543      jQuery(function($){
 
Line Code
2688 function media_upload_library_form( $errors ) {
2689      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2690
2691      media_upload_header();
2692
2693      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2694
2695      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2696      /** This filter is documented in wp-admin/includes/media.php */
2697      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2698      $form_class      = 'media-upload-form validate';
2699
2700      if ( get_user_setting( 'uploader' ) ) {
2701           $form_class .= ' html-uploader';
2702      }
2703
2704      $q                   = $_GET;
2705      $q['posts_per_page'] = 10;
2706      $q['paged']          = isset( $q['paged'] ) ? (int) $q['paged'] : 0;