Using WordPress ‘manage_{$this->screen->id}_custom_column’ PHP action

The manage_{$this->screen->id}_custom_column WordPress action allows you to modify the content of custom columns in the Application Passwords list table.

Usage

add_action('manage_application-passwords-user_columns', 'your_custom_code');
function your_custom_code($column_name, $item) {
  // your custom code here
}

Parameters

  • $column_name (string) – Name of the custom column.
  • $item (array) – The application password item.

More information

See WordPress Developer Resources: manage_{$this->screen->id}_custom_column

Examples

Adding a custom column to display password creation date

Add a custom column to show the creation date of the application password:

// Register the custom column
add_filter('manage_application-passwords-user_columns', 'add_creation_date_column');
function add_creation_date_column($columns) {
  $columns['creation_date'] = 'Creation Date';
  return $columns;
}

// Display the creation date in the custom column
add_action('manage_application-passwords-user_columns', 'display_creation_date', 10, 2);
function display_creation_date($column_name, $item) {
  if ($column_name == 'creation_date') {
    echo esc_html($item['creation_date']);
  }
}

Add a custom column to show application password usage count

Add a custom column to display the usage count of the application password:

// Register the custom column
add_filter('manage_application-passwords-user_columns', 'add_usage_count_column');
function add_usage_count_column($columns) {
  $columns['usage_count'] = 'Usage Count';
  return $columns;
}

// Display the usage count in the custom column
add_action('manage_application-passwords-user_columns', 'display_usage_count', 10, 2);
function display_usage_count($column_name, $item) {
  if ($column_name == 'usage_count') {
    echo esc_html($item['usage_count']);
  }
}

Add a custom column to display application password last used date

Add a custom column to show the last used date of the application password:

// Register the custom column
add_filter('manage_application-passwords-user_columns', 'add_last_used_date_column');
function add_last_used_date_column($columns) {
  $columns['last_used_date'] = 'Last Used Date';
  return $columns;
}

// Display the last used date in the custom column
add_action('manage_application-passwords-user_columns', 'display_last_used_date', 10, 2);
function display_last_used_date($column_name, $item) {
  if ($column_name == 'last_used_date') {
    echo esc_html($item['last_used_date']);
  }
}

Add a custom column to show application password status

Add a custom column to display the status of the application password:

// Register the custom column
add_filter('manage_application-passwords-user_columns', 'add_status_column');
function add_status_column($columns) {
  $columns['status'] = 'Status';
  return $columns;
}

// Display the status in the custom column
add_action('manage_application-passwords-user_columns', 'display_status', 10, 2);
function display_status($column_name, $item) {
  if ($column_name == 'status') {
    echo esc_html($item['status'] ? 'Active' : 'Inactive');
  }
}