1

Is there any way to customise the wordpress update notice in the backend admin area?

wordpress 3.9 update notice

I want to make it so that I can change the Please update now to Please contact now and link to a different URL. So the person running the website doesn't update the website, since they don't know how to back up the website.

I have found ways to hide the notice online, but no way to actually edit it.

1 Answer 1

2

I did not find any hook available to customize the message. So decided to remove the original update nag and have our custom nag over there.

Lets first remove the original nag

// Admin menu hook
add_action( 'admin_menu', 'remove_core_update_nag', 2 );

/**
 * Remove the original update nag
 */
function remove_core_update_nag() {
    remove_action( 'admin_notices', 'update_nag', 3 );
    remove_action( 'network_admin_notices', 'update_nag', 3 );
}

Once that's removed, we will put our custom nag.

// Admin notice hook
add_action( 'admin_notices', 'custom_update_nag', 99 );
add_action( 'network_admin_notices', 'custom_update_nag', 99 );

/**
 * Custom update nag
 */
function custom_update_nag() {
    if ( is_multisite() && !current_user_can('update_core') )
        return false;

    global $pagenow;

    if ( 'update-core.php' == $pagenow )
        return;

    $cur = get_preferred_from_update_core();

    if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
        return false;

    if ( current_user_can('update_core') ) {
        $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please contact now</a>.'), $cur->current, 'your_custom_url' );
    } else {
        $msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
    }

    echo "<div class='update-nag'>$msg</div>";
}

Please make sure you need to replace your_custom_url with the actual link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.