Getting the WordPress version after the update in the upgrader_process_complete hook

211 Views Asked by At

I plan to get the new version of the core after updating the WordPress core. I use global variable $wp_version when in upgrader_process_complete hook. The number that is announced to me is related to the version before the update and is not new.

How can I get the new version or the real version after the kernel update?

My Code:

add_action( 'upgrader_process_complete', 'letsGoo', 10, 2 );
function letsGoo( $upgrader_object, $options ) {

      if ($options['action'] == 'update' ){

            $file = ABSPATH."wLog.txt";
            $myfile = fopen($file, "a+") or die("Unable to open file!");
            $txt = "**** After Update Core ****";
            fwrite( $myfile, $txt );
            fwrite( $myfile, print_r( get_bloginfo( 'version' ), true ) );
            fclose( $myfile );

    }

}

Regards Sajad

0

There are 0 best solutions below