# List Active Plugins First on the Plugins Screen

> Moves active plugins to the top of the Plugins screen, followed by the inactive ones, keeping alphabetical order inside each group.

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

## Code

```php
// Reorders the rows of the Plugins screen so active plugins come first. Alphabetical order is kept inside each group.
add_action( 'admin_footer-plugins.php', function () {
    ?>
    <script>
    ( function () {
        var list = document.getElementById( 'the-list' );
        if ( ! list ) {
            return;
        }

        // A plugin row can be followed by its update notice and rows added by other plugins.
        var groups = [];
        var current = null;
        Array.prototype.slice.call( list.children ).forEach( function ( row ) {
            if ( row.hasAttribute( 'data-plugin' ) && ! row.classList.contains( 'plugin-update-tr' ) ) {
                current = { active: row.classList.contains( 'active' ), rows: [] };
                groups.push( current );
            }
            if ( current ) {
                current.rows.push( row );
            }
        } );

        var ordered = groups.filter( function ( group ) { return group.active; } )
            .concat( groups.filter( function ( group ) { return ! group.active; } ) );

        ordered.forEach( function ( group ) {
            group.rows.forEach( function ( row ) {
                list.appendChild( row );
            } );
        } );
    } )();
    </script>
    <?php
} );
```

## Notes

The rows are reordered in the browser as the screen loads. Search, filters and bulk actions work as usual.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "List Active Plugins First on the Plugins Screen" 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/
