update_nag()


Description Description


Return Return

(false|void)


Top ↑

Source Source

File: wp-admin/includes/update.php

248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
function 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;
    }
 
    $version_url = sprintf(
        /* translators: %s: WordPress version */
        sanitize_title( $cur->current )
    );
 
    if ( current_user_can( 'update_core' ) ) {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: new WordPress version, 3: URL to network admin, 4: accessibility text */
            __( '<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.' ),
            $version_url,
            $cur->current,
            network_admin_url( 'update-core.php' ),
            esc_attr__( 'Please update WordPress now' )
        );
    } else {
        $msg = sprintf(
            /* translators: 1: URL to WordPress release notes, 2: new WordPress version */
            __( '<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.' ),
            $version_url,
            $cur->current
        );
    }
    echo "<div class='update-nag'>$msg</div>";
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.