# Slug Column in Admin Lists

> Adds a Slug column to the posts and pages lists so you can check permalinks without opening each item.

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

## Code

```php
// Post types that get the Slug column.
$wpide_slug_post_types = array( 'post', 'page' );

foreach ( $wpide_slug_post_types as $wpide_slug_type ) {
    add_filter( "manage_{$wpide_slug_type}_posts_columns", function ( $columns ) {
        $columns['wpide_slug'] = 'Slug';

        return $columns;
    } );

    add_action( "manage_{$wpide_slug_type}_posts_custom_column", function ( $column, $post_id ) {
        if ( 'wpide_slug' === $column ) {
            echo '<code>' . esc_html( urldecode( (string) get_post_field( 'post_name', $post_id ) ) ) . '</code>';
        }
    }, 10, 2 );
}
```

## Notes

Add custom post type names to $wpide_slug_post_types to show the column there too.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Slug Column in Admin Lists" 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/
