Using WordPress ‘manage_themes_custom_column’ PHP action

The manage_themes_custom_column WordPress action fires inside each custom column of the Multisite themes list table. It helps you customize the content of the custom columns in the themes list table.

Usage

add_action('manage_themes_custom_column', 'your_custom_function', 10, 3);

function your_custom_function($column_name, $stylesheet, $theme) {
    // your custom code here
}

Parameters

  • $column_name (string) – Name of the column.
  • $stylesheet (string) – Directory name of the theme.
  • $theme (WP_Theme) – Current WP_Theme object.

More information

See WordPress Developer Resources: manage_themes_custom_column

Examples

Add a custom column with theme version

Display the theme version in a custom column:

// Add a custom column
add_filter('manage_themes-network_columns', 'add_theme_version_column', 10, 1);
function add_theme_version_column($columns) {
$columns['version'] = 'Version';
return $columns;
}

// Display theme version in the custom column
add_action('manage_themes_custom_column', 'display_theme_version', 10, 3);
function display_theme_version($column_name, $stylesheet, $theme) {
if ($column_name == 'version') {
echo $theme->get('Version');
}
}

Display theme author

Show the theme author in a custom column:

// Add a custom column
add_filter('manage_themes-network_columns', 'add_theme_author_column', 10, 1);
function add_theme_author_column($columns) {
$columns['author'] = 'Author';
return $columns;
}

// Display theme author in the custom column
add_action('manage_themes_custom_column', 'display_theme_author', 10, 3);
function display_theme_author($column_name, $stylesheet, $theme) {
if ($column_name == 'author') {
echo $theme->get('Author');
}
}

Show a theme's license

Display the theme's license information in a custom column:

// Add a custom column
add_filter('manage_themes-network_columns', 'add_theme_license_column', 10, 1);
function add_theme_license_column($columns) {
$columns['license'] = 'License';
return $columns;
}

// Display theme license in the custom column
add_action('manage_themes_custom_column', 'display_theme_license', 10, 3);
function display_theme_license($column_name, $stylesheet, $theme) {
if ($column_name == 'license') {
echo $theme->get('License');
}
}

Display the number of available widgets

Show the number of available widgets for a theme in a custom column:

// Add a custom column
add_filter('manage_themes-network_columns', 'add_theme_widgets_column', 10, 1);
function add_theme_widgets_column($columns) {
$columns['widgets'] = 'Widgets';
return $columns;
}

// Display the number of available widgets in the custom column
add_action('manage_themes_custom_column', 'display_theme_widgets', 10, 3);
function display_theme_widgets($column_name, $stylesheet, $theme) {
if ($column_name == 'widgets') {
$widgets_count = count($theme->get('Widget Areas'));
echo $widgets_count;
}
}