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