Programmatically upgrade WordPress core with PHP?

I want to upgrade to latest wordpress version with php.

if(isset($_GET['core-update'])){
        require_once('wp-load.php'); 
}

tried:

1 - wp_update_core();
2 - wp_maybe_auto_update();
3 - Core_Upgrader::upgrade();

All that I found online or in wordpress codecs. To my mind this should be a really simple function, but what am I missing?

Leave a Comment