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
2338
2339      /**
2340       * Filters the media upload form action URL.
2341       *
2342       * @since 2.6.0
2343       *
2344       * @param string $form_action_url The media upload form action URL.
2345       * @param string $type            The type of media. Default 'file'.
2346       */
2347      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2348      $form_class      = 'media-upload-form type-form validate';
2349
2350      if ( get_user_setting( 'uploader' ) ) {
2351           $form_class .= ' html-uploader';
2352      }
2353
2354      ?>
2355      <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">
2356           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2407           $type = 'image';
2408      }
2409
2410      media_upload_header();
2411
2412      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2413
2414      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2415      /** This filter is documented in wp-admin/includes/media.php */
2416      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2417      $form_class      = 'media-upload-form type-form validate';
2418
2419      if ( get_user_setting( 'uploader' ) ) {
2420           $form_class .= ' html-uploader';
2421      }
2422
2423      ?>
2424      <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">
2425      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2554 function media_upload_gallery_form( $errors ) {
2555      global $redir_tab, $type;
2556
2557      $redir_tab = 'gallery';
2558      media_upload_header();
2559
2560      $post_id         = (int) $_REQUEST['post_id'];
2561      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2562      /** This filter is documented in wp-admin/includes/media.php */
2563      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2564      $form_class      = 'media-upload-form validate';
2565
2566      if ( get_user_setting( 'uploader' ) ) {
2567           $form_class .= ' html-uploader';
2568      }
2569
2570      ?>
2571      <script type="text/javascript">
2572      jQuery(function($){
 
Line Code
2717 function media_upload_library_form( $errors ) {
2718      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2719
2720      media_upload_header();
2721
2722      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2723
2724      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2725      /** This filter is documented in wp-admin/includes/media.php */
2726      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2727      $form_class      = 'media-upload-form validate';
2728
2729      if ( get_user_setting( 'uploader' ) ) {
2730           $form_class .= ' html-uploader';
2731      }
2732
2733      $q                   = $_GET;
2734      $q['posts_per_page'] = 10;
2735      $q['paged']          = isset( $q['paged'] ) ? (int) $q['paged'] : 0;