How to prevent redirect to ‘About’ after core upgrade?

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:

Read More
<?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.

Related posts

Leave a Reply

1 comment

  1. 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.

    function tp_dont_redirect_to_about_wordpress( $new_version ) {
        global $wp_version, $pagenow, $action;
    
        if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )
            return;
    
        // Ensure we only run this on the update-core.php page. wp_update_core() could be called in other contexts.
        if ( 'update-core.php' != $pagenow )
            return;
    
        if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action )
            return;
    
        // Load the updated default text localization domain for new strings
        load_default_textdomain();
    
        // See do_core_upgrade()
        show_message( __('WordPress updated successfully') );
        show_message( '<span>' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
        echo '</div>';
    
        // Include admin-footer.php and exit
        include(ABSPATH . 'wp-admin/admin-footer.php');
        exit();
    }
    add_action( '_core_updated_successfully', 'tp_dont_redirect_to_about_wordpress', 1, 1 );
    

    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.