MainWP Community

Listing / Version number

Hello,

Is it possible to see the WP version number in the sites list ?

I’ve searched a little but found no answers in other topics.

Thanks.

Have a nice day.

1 Like

Hi David, something like this is already possible so along with the solution, I will move this topic to the “How do I” category.

For the start, you will need the MainWP Custom Dashboard Extension, it will allow you to apply custom code sippets to your MainWP Dashboard. Once you have it set, please use the following code in the PHP Section:

// First filter is to create column
add_filter( 'mainwp-sitestable-getcolumns', 'mycustom_sites_table_column', 10 );
function mycustom_sites_table_column( $cols ) {
     $cols['wpversion'] = 'WP Version';
     return $cols;
}

// Second filter is to get column data
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['wpversion' ] ) ) {
          $item[ 'wpversion' ] = $website_info[ 'wpversion' ];
     } else {
          $item[ 'wpversion' ] = '';
     }
     return $item;
}

Please let me know how that goes.

3 Likes

Hey Bogdan,

Thanks for the hook.

Didn’t install the extension, i created a must-use plugin.

Works perfectly… Thanks!

Have a nice day!

David

1 Like

Thanks for letting me know! I am very happy to hear that the solution worked for you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.