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
2285
2286      /**
2287       * Filters the media upload form action URL.
2288       *
2289       * @since 2.6.0
2290       *
2291       * @param string $form_action_url The media upload form action URL.
2292       * @param string $type            The type of media. Default 'file'.
2293       */
2294      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2295      $form_class      = 'media-upload-form type-form validate';
2296
2297      if ( get_user_setting( 'uploader' ) ) {
2298           $form_class .= ' html-uploader';
2299      }
2300
2301      ?>
2302      <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">
2303           <?php submit_button( '', 'hidden', 'save', false ); ?>
 
Line Code
2354           $type = 'image';
2355      }
2356
2357      media_upload_header();
2358
2359      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2360
2361      $form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
2362      /** This filter is documented in wp-admin/includes/media.php */
2363      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2364      $form_class      = 'media-upload-form type-form validate';
2365
2366      if ( get_user_setting( 'uploader' ) ) {
2367           $form_class .= ' html-uploader';
2368      }
2369
2370      ?>
2371      <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">
2372      <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 
Line Code
2501 function media_upload_gallery_form( $errors ) {
2502      global $redir_tab, $type;
2503
2504      $redir_tab = 'gallery';
2505      media_upload_header();
2506
2507      $post_id         = intval( $_REQUEST['post_id'] );
2508      $form_action_url = admin_url( "media-upload.php?type=$type&tab=gallery&post_id=$post_id" );
2509      /** This filter is documented in wp-admin/includes/media.php */
2510      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2511      $form_class      = 'media-upload-form validate';
2512
2513      if ( get_user_setting( 'uploader' ) ) {
2514           $form_class .= ' html-uploader';
2515      }
2516
2517      ?>
2518      <script type="text/javascript">
2519      jQuery(function($){
 
Line Code
2665 function media_upload_library_form( $errors ) {
2666      global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
2667
2668      media_upload_header();
2669
2670      $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2671
2672      $form_action_url = admin_url( "media-upload.php?type=$type&tab=library&post_id=$post_id" );
2673      /** This filter is documented in wp-admin/includes/media.php */
2674      $form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2675      $form_class      = 'media-upload-form validate';
2676
2677      if ( get_user_setting( 'uploader' ) ) {
2678           $form_class .= ' html-uploader';
2679      }
2680
2681      $q                   = $_GET;
2682      $q['posts_per_page'] = 10;
2683      $q['paged']          = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;