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
2312
2313      /**
2314       * Filters the media upload form action URL.
2315       *
2316       * @since 2.6.0
2317       *
2318       * @param string $form_action_url The media upload form action URL.
2319       * @param string $type            The type of media. Default 'file'.
2320       */
2321      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2322      $form_class      = 'media-upload-form type-form validate';
2323
2324      if ( get_user_setting( 'uploader' ) ) {
2325           $form_class .= ' html-uploader';
2326      }
2327
2328      ?>
2329      <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">
2330           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2381           $type = 'image';
2382      }
2383
2384      media_upload_header();
2385
2386      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2387
2388      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2389      /** This filter is documented in wp-admin/includes/media.php */
2390      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2391      $form_class      = 'media-upload-form type-form validate';
2392
2393      if ( get_user_setting( 'uploader' ) ) {
2394           $form_class .= ' html-uploader';
2395      }
2396
2397      ?>
2398      <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">
2399      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2528 function media_upload_gallery_form( $errors ) {
2529      global $redir_tab, $type;
2530
2531      $redir_tab = 'gallery';
2532      media_upload_header();
2533
2534      $post_id         = (int) $_REQUEST['post_id'];
2535      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2536      /** This filter is documented in wp-admin/includes/media.php */
2537      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2538      $form_class      = 'media-upload-form validate';
2539
2540      if ( get_user_setting( 'uploader' ) ) {
2541           $form_class .= ' html-uploader';
2542      }
2543
2544      ?>
2545      <script type="text/javascript">
2546      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;