# Open the Media Library in List View

> Shows Media > Library as a table by default instead of the thumbnail grid, which makes file names, dates, authors and attachment details easier to scan on large libraries.

- Type: PHP
- Runs: Admin only
- Category: [Media](https://wpide.com/library/category/media/)
- Tags: media-library, list-view, admin
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/media-library-list-view-default/

## Code

```php
add_filter( 'get_user_option_media_library_mode', function ( $mode ) {
    return isset( $_GET['mode'] ) && in_array( $_GET['mode'], array( 'grid', 'list' ), true ) ? sanitize_key( $_GET['mode'] ) : 'list';
} );
```

## Notes

Users can still switch to the grid with the icons above the list; the default only applies when no mode is chosen in the address.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Open the Media Library in List View" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
