Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Show IDs in the admin lists

Adds an ID column to the lists of posts, pages, media and users.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Tested with WordPress 7.1
PHP
<?php

$add_column = static function ( $columns ) {
	$columns['sf_id'] = 'ID';
	return $columns;
};
$show_id    = static function ( $column, $id ) {
	if ( 'sf_id' === $column ) {
		echo (int) $id;
	}
};

add_filter( 'manage_posts_columns', $add_column );
add_action( 'manage_posts_custom_column', $show_id, 10, 2 );
add_filter( 'manage_pages_columns', $add_column );
add_action( 'manage_pages_custom_column', $show_id, 10, 2 );
add_filter( 'manage_media_columns', $add_column );
add_action( 'manage_media_custom_column', $show_id, 10, 2 );
add_filter( 'manage_users_columns', $add_column );
add_filter( 'manage_users_custom_column', static fn( $value, $column, $user_id ) => 'sf_id' === $column ? (string) (int) $user_id : $value, 10, 3 );

add_action(
	'admin_head',
	static function () {
		echo '<style>.column-sf_id{width:5em}</style>';
	}
);

In these packs

  • Admin and login: Your branding on the login page, a tidier admin, and handy extras such as duplicating posts.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.