In wp-admin/includes/update-core.php
we find the following line:
add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
I want to remove this action, so I created a mu plugin with the following content:
<?php # -*- coding: utf-8 -*-
add_action( '_core_updated_successfully', 't5_no_redirect_after_update', 0 );
function t5_no_redirect_after_update()
{
remove_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
}
It does ⦠nothing. I am still redirected. Tested with single site and multi site installations.
I guess I miss something obvious, as usual. 🙂
How to do it better?
Update
Based on Bradyâs answer I build a very minimal version:
<?php # -*- coding: utf-8 -*-
/* Plugin Name: T5 No redirect after core upgrade. */
add_action( '_core_updated_successfully', 't5_no_redirect_after_update', 0 );
function t5_no_redirect_after_update()
{
show_message( __('WordPress updated successfully') );
// Include admin-footer.php and exit
include(ABSPATH . 'wp-admin/admin-footer.php');
exit;
}
Now we see the success message and no other action is called. You can download the plugin on GitHub. Use it as regular plugin or as MU plugin.
Don’t remove the action but add your own before it. If you remove the action you will never get the message saying it was upgraded successfully. Here you can provide your own info on what to do next.
I know in chat you showed that you had difficulty removing the action so I set about looking for a solution that doesn’t remove the action but adds one before it.
The above code is a copy of the core function it hooks on
_core_updated_successfully
but strips out the redirect and a few messages.As you can see there is an
exit();
at the end of the function so if you hook this function before the other then the exit should stop any further hooks from firing.