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
2325
2326      /**
2327       * Filters the media upload form action URL.
2328       *
2329       * @since 2.6.0
2330       *
2331       * @param string $form_action_url The media upload form action URL.
2332       * @param string $type            The type of media. Default 'file'.
2333       */
2334      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2335      $form_class      = 'media-upload-form type-form validate';
2336
2337      if ( get_user_setting( 'uploader' ) ) {
2338           $form_class .= ' html-uploader';
2339      }
2340
2341      ?>
2342      <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">
2343           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2394           $type = 'image';
2395      }
2396
2397      media_upload_header();
2398
2399      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2400
2401      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2402      /** This filter is documented in wp-admin/includes/media.php */
2403      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2404      $form_class      = 'media-upload-form type-form validate';
2405
2406      if ( get_user_setting( 'uploader' ) ) {
2407           $form_class .= ' html-uploader';
2408      }
2409
2410      ?>
2411      <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">
2412      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2541 function media_upload_gallery_form( $errors ) {
2542      global $redir_tab, $type;
2543
2544      $redir_tab = 'gallery';
2545      media_upload_header();
2546
2547      $post_id         = (int) $_REQUEST['post_id'];
2548      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2549      /** This filter is documented in wp-admin/includes/media.php */
2550      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2551      $form_class      = 'media-upload-form validate';
2552
2553      if ( get_user_setting( 'uploader' ) ) {
2554           $form_class .= ' html-uploader';
2555      }
2556
2557      ?>
2558      <script type="text/javascript">
2559      jQuery(function($){
 
Line Code
2704 function media_upload_library_form( $errors ) {
2705      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2706
2707      media_upload_header();
2708
2709      $post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
2710
2711      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2712      /** This filter is documented in wp-admin/includes/media.php */
2713      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2714      $form_class      = 'media-upload-form validate';
2715
2716      if ( get_user_setting( 'uploader' ) ) {
2717           $form_class .= ' html-uploader';
2718      }
2719
2720      $q                   = $_GET;
2721      $q['posts_per_page'] = 10;
2722      $q['paged']          = isset( $q['paged'] ) ? (int) $q['paged'] : 0;