Skip to main content
You can add custom columns to the Manage Sites table to display additional site information. This guide shows how to create columns using PHP filters in the Custom Dashboard extension.

What You’ll Learn

  • How to add custom columns to the Manage Sites table
  • How to populate columns with site data
  • How to position columns in the table

Prerequisites


Example: Add a cURL Version Column

This example adds a column that displays the cURL version for each child site.
1

Install Custom Dashboard

Install the Custom Dashboard extension.
2

Open the extension

Navigate to MainWP > Add-ons > Custom Dashboard.
3

Add the PHP code

Go to the PHP tab and add this code:
add_filter( 'mainwp_sitestable_getcolumns', 'mycustom_sites_table_column', 10 );
function mycustom_sites_table_column( $cols ) {
    $cols['child_curl_version'] = 'cURL Version';
    return $cols;
}

add_filter( 'mainwp_sitestable_item', 'mycustom_sitestable_item', 10 );
function mycustom_sitestable_item( $item ) {
    $options = apply_filters( 'mainwp_getwebsiteoptions', array(), $item['id'], 'site_info' );
    $website_info = json_decode( $options, true );
    if ( is_array( $website_info ) && isset( $website_info['child_curl_version'] ) ) {
        $item['child_curl_version'] = $website_info['child_curl_version'];
    } else {
        $item['child_curl_version'] = '';
    }
    return $item;
}
4

Save changes

Click Save Changes.
5

Verify the column

Navigate to MainWP > Sites > Manage Sites to see the new column.Manage Sites table showing the new cURL Version column
6

Position the column

Drag and drop the column header to your preferred position.

How It Works

The code uses two WordPress filters:
FilterPurpose
mainwp_sitestable_getcolumnsRegisters the new column in the table header
mainwp_sitestable_itemPopulates the column with data for each row

Code Structure

// Step 1: Register the column
add_filter( 'mainwp_sitestable_getcolumns', 'my_custom_column', 10 );
function my_custom_column( $cols ) {
    $cols['column_key'] = 'Column Header';  // Key must be unique
    return $cols;
}

// Step 2: Populate the column data
add_filter( 'mainwp_sitestable_item', 'my_custom_item', 10 );
function my_custom_item( $item ) {
    $item['column_key'] = 'Value';  // Key matches the column key above
    return $item;
}

Available Site Data

You can access various site information through the mainwp_getwebsiteoptions filter:
$options = apply_filters( 'mainwp_getwebsiteoptions', array(), $item['id'], 'site_info' );
$website_info = json_decode( $options, true );
Common available fields include:
  • child_curl_version - cURL version
  • phpversion - PHP version
  • wp_version - WordPress version
  • child_site_info - Various site details

Other Column Examples


Self-Check Checklist

  • Custom Dashboard extension installed
  • PHP code added and saved
  • New column appears in Manage Sites table
  • Column displays correct data
  • Column positioned as desired