0

Could somebody provide a code snippet which would show current php version inside the "At a glance" box win Wordpress admin? There are plugins but I'd like to do it with a code.

1 Answer 1

1

This one will add php version at the bottom of 'at a glance' metabox, where goes wordpress version with active theme name.

function update_right_now_text_callback($content){
    $php_version = __('PHP version: ') . phpversion();
    return $php_version . ' | ' . $content;
}

add_filter( 'update_right_now_text', 'update_right_now_text_callback' );

If you want to add it as content list item for some reason, this snippet work:

function dashboard_glance_items_callback( $data = [] ) {
    $data[]      = 'PHP version: ' . phpversion();
    return $data;
}

add_filter( 'dashboard_glance_items', 'dashboard_glance_items_callback' );
1
  • 1
    Thanks @anton, worked perfectly! Commented May 5, 2021 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.