How can I ping update-core.php with a script?

I have the paid Divi theme on many websites on a cPanel powered server. I use WP-CLI in a bash script to update all the plugins and themes. But Divi will never update because it only reveals an update is available when you visit wp-admin/update-core.php When you visit that main update page with a browser, you’ll see the update number next to “Updates” magically grow by +1.

What I want to do is call update-core.php so it runs one time, because after that happens, WP-CLI is able to detect the Divi update without any problem. At least this is what I think I want to do. Clearly I’m open to suggestions.

What I’ve tried so far:

This is the php script in the public web root:

define( ‘WP_ADMIN’, true );
//define( ‘SHORTINIT’, true );
require( $path.’/wp-load.php’ );
require( $path.’/wp-admin/update-core.php’ );

But calling that from a browser just goes to a login screen, because it fails the current_user_can checks at the beginning of update-core.php Should I try to create a hacked version of update-core.php that has no user checks? Am I pursuing the wrong path entirely?

There was a discussion on GitHub but I was not able to get the –require feature to work with a script containing define( ‘WP_ADMIN’, true );

The bash script I use to bulk update is like this–


declare -a arr=(

for i in “${arr[@]}”
echo “$i”
echo ______________________________________________________
cd /home/”$i”/www
wp core update-db –allow-root
wp core update –allow-root
wp plugin update –all –allow-root
wp theme update –all –allow-root
chown -R “$i”:”$i” *

Read more here:: How can I ping update-core.php with a script?

Leave a Reply

Your email address will not be published. Required fields are marked *