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
2320
2321      /**
2322       * Filters the media upload form action URL.
2323       *
2324       * @since 2.6.0
2325       *
2326       * @param string $form_action_url The media upload form action URL.
2327       * @param string $type            The type of media. Default 'file'.
2328       */
2329      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2330      $form_class      = 'media-upload-form type-form validate';
2331
2332      if ( get_user_setting( 'uploader' ) ) {
2333           $form_class .= ' html-uploader';
2334      }
2335
2336      ?>
2337      <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">
2338           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2389           $type = 'image';
2390      }
2391
2392      media_upload_header();
2393
2394      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2395
2396      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2397      /** This filter is documented in wp-admin/includes/media.php */
2398      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2399      $form_class      = 'media-upload-form type-form validate';
2400
2401      if ( get_user_setting( 'uploader' ) ) {
2402           $form_class .= ' html-uploader';
2403      }
2404
2405      ?>
2406      <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">
2407      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2536 function media_upload_gallery_form( $errors ) {
2537      global $redir_tab, $type;
2538
2539      $redir_tab = 'gallery';
2540      media_upload_header();
2541
2542      $post_id         = (int) $_REQUEST['post_id'];
2543      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2544      /** This filter is documented in wp-admin/includes/media.php */
2545      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2546      $form_class      = 'media-upload-form validate';
2547
2548      if ( get_user_setting( 'uploader' ) ) {
2549           $form_class .= ' html-uploader';
2550      }
2551
2552      ?>
2553      <script type="text/javascript">
2554      jQuery(function($){
 
Line Code
2699 function media_upload_library_form( $errors ) {
2700      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2701
2702      media_upload_header();
2703
2704      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2705
2706      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2707      /** This filter is documented in wp-admin/includes/media.php */
2708      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2709      $form_class      = 'media-upload-form validate';
2710
2711      if ( get_user_setting( 'uploader' ) ) {
2712           $form_class .= ' html-uploader';
2713      }
2714
2715      $q                   = $_GET;
2716      $q['posts_per_page'] = 10;
2717      $q['paged']          = isset( $q['paged'] ) ? (int) $q['paged'] : 0;