Title: the_media_upload_tabs
Published: April 25, 2014
Last modified: August 20, 2026

---

# the_media_upload_tabs()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#changelog)

Outputs the legacy media upload tabs UI.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#source)󠁿

    ```php
    function the_media_upload_tabs() {
    	global $redir_tab;
    	$tabs    = media_upload_tabs();
    	$default = 'type';

    	if ( ! empty( $tabs ) ) {
    		echo "<ul id='sidemenu'>\n";

    		if ( isset( $redir_tab ) && array_key_exists( $redir_tab, $tabs ) ) {
    			$current = $redir_tab;
    		} elseif ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $tabs ) ) {
    			$current = $_GET['tab'];
    		} else {
    			/** This filter is documented in wp-admin/media-upload.php */
    			$current = apply_filters( 'media_upload_default_tab', $default );
    		}

    		foreach ( $tabs as $callback => $text ) {
    			$class = '';

    			if ( $current === $callback ) {
    				$class = " class='current'";
    			}

    			$href = add_query_arg(
    				array(
    					'tab'            => $callback,
    					's'              => false,
    					'paged'          => false,
    					'post_mime_type' => false,
    					'm'              => false,
    				)
    			);
    			$link = "<a href='" . esc_url( $href ) . "'$class>$text</a>";
    			echo "\t<li id='" . esc_attr( "tab-$callback" ) . "'>$link</li>\n";
    		}

    		echo "</ul>\n";
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/media.php#L76)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/media.php#L76-L115)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#hooks)󠁿

 [apply_filters( ‘media_upload_default_tab’, string $tab )](https://developer.wordpress.org/reference/hooks/media_upload_default_tab/)

Filters the default tab in the legacy (pre-3.5.0) media popup.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#related)󠁿

| Uses | Description | 
| [media_upload_tabs()](https://developer.wordpress.org/reference/functions/media_upload_tabs/)`wp-admin/includes/media.php` |

Defines the default media upload tabs.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#)

| Used by | Description | 
| [media_upload_header()](https://developer.wordpress.org/reference/functions/media_upload_header/)`wp-admin/includes/media.php` |

Outputs the legacy media upload header.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/the_media_upload_tabs/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fthe_media_upload_tabs%2F)
before being able to contribute a note or feedback.