# List Enqueued Scripts and Styles in the Page Source

> Prints an HTML comment at the bottom of each page, visible to administrators, listing every script and stylesheet handle loaded and its source, to find what to optimize.

- Type: PHP
- Runs: Frontend only
- Category: [Developer](https://wpide.com/library/category/developer/)
- Tags: debugging, scripts, styles, performance
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/dev-list-enqueued-assets/

## Code

```php
add_action( 'wp_print_footer_scripts', function () {
    if ( ! current_user_can( 'manage_options' ) ) {
        return;
    }

    $lines = array( 'Enqueued assets' );

    foreach ( array( 'scripts' => wp_scripts(), 'styles' => wp_styles() ) as $type => $deps ) {
        $lines[] = strtoupper( $type ) . ':';

        foreach ( $deps->done as $handle ) {
            $src     = isset( $deps->registered[ $handle ] ) ? (string) $deps->registered[ $handle ]->src : '';
            $lines[] = '  ' . $handle . ( $src ? ' => ' . $src : ' (inline/alias)' );
        }
    }

    echo "\n<!--\n" . esc_html( str_replace( '--', '- -', implode( "\n", $lines ) ) ) . "\n-->\n";
}, 999 );
```

## Notes

View the page source and look for "Enqueued assets" near the end.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "List Enqueued Scripts and Styles in the Page Source" 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/
