Auto Update Core wp with functions.php manually in Code

Create your plugin or theme functions.php file. The Codex recommends that you use an mu-plugin to do that — that is a “must-use” plugin that WordPress always has on. But WordPress will honor this code if it’s in an enable plugin or theme as well.

How to Enable WordPress Plugin Auto-Updates Manually in PHP Code

Put in the line of code: Update All Plugins Automatcally

add_filter( 'auto_update_plugin', '__return_true' );

Put in the line of code: Update All Themes Automatcally

add_filter( 'auto_update_theme', '__return_true' );

Make sure this code is somewhere it will run. If you’ve created this as a new plugin in the mu-plugins directory, it will. If you’ve enabled the (normal) plugin, it will. If you have it in functions.php of your currently running theme, it will.

Enable WordPress Core File Updates Manually in Code

To enable the WordPress core files to update automatically, you need to add the following line of code to your wp-config.php file:

define( 'WP_AUTO_UPDATE_CORE', true );

You can easily access this file by going to cPanel -> File Manager and then navigating to the location of your
wp-config.php file.