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
2333
2334      /**
2335       * Filters the media upload form action URL.
2336       *
2337       * @since 2.6.0
2338       *
2339       * @param string $form_action_url The media upload form action URL.
2340       * @param string $type            The type of media. Default 'file'.
2341       */
2342      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2343      $form_class      = 'media-upload-form type-form validate';
2344
2345      if ( get_user_setting( 'uploader' ) ) {
2346           $form_class .= ' html-uploader';
2347      }
2348
2349      ?>
2350      <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">
2351           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2402           $type = 'image';
2403      }
2404
2405      media_upload_header();
2406
2407      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2408
2409      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2410      /** This filter is documented in wp-admin/includes/media.php */
2411      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2412      $form_class      = 'media-upload-form type-form validate';
2413
2414      if ( get_user_setting( 'uploader' ) ) {
2415           $form_class .= ' html-uploader';
2416      }
2417
2418      ?>
2419      <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">
2420      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2549 function media_upload_gallery_form( $errors ) {
2550      global $redir_tab, $type;
2551
2552      $redir_tab = 'gallery';
2553      media_upload_header();
2554
2555      $post_id         = (int) $_REQUEST['post_id'];
2556      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2557      /** This filter is documented in wp-admin/includes/media.php */
2558      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2559      $form_class      = 'media-upload-form validate';
2560
2561      if ( get_user_setting( 'uploader' ) ) {
2562           $form_class .= ' html-uploader';
2563      }
2564
2565      ?>
2566      <script type="text/javascript">
2567      jQuery(function($){
 
Line Code
2712 function media_upload_library_form( $errors ) {
2713      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2714
2715      media_upload_header();
2716
2717      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2718
2719      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2720      /** This filter is documented in wp-admin/includes/media.php */
2721      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2722      $form_class      = 'media-upload-form validate';
2723
2724      if ( get_user_setting( 'uploader' ) ) {
2725           $form_class .= ' html-uploader';
2726      }
2727
2728      $q                   = $_GET;
2729      $q['posts_per_page'] = 10;
2730      $q['paged']          = isset( $q['paged'] ) ? (int) $q['paged'] : 0;