core_update_footer( string $msg = '' )


Description Description


Parameters Parameters

$msg

(string) (Optional)

Default value: ''


Top ↑

Return Return

(string)


Top ↑

Source Source

File: wp-admin/includes/update.php

function core_update_footer( $msg = '' ) {
	if ( ! current_user_can( 'update_core' ) ) {
		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
	}

	$cur = get_preferred_from_update_core();
	if ( ! is_object( $cur ) ) {
		$cur = new stdClass;
	}

	if ( ! isset( $cur->current ) ) {
		$cur->current = '';
	}

	if ( ! isset( $cur->url ) ) {
		$cur->url = '';
	}

	if ( ! isset( $cur->response ) ) {
		$cur->response = '';
	}

	switch ( $cur->response ) {
		case 'development':
			/* translators: 1: WordPress version number, 2: WordPress updates admin screen URL */
			return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) );

		case 'upgrade':
			return '<strong><a href="' . network_admin_url( 'update-core.php' ) . '">' . sprintf( __( 'Get Version %s' ), $cur->current ) . '</a></strong>';

		case 'latest':
		default:
			return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
	}
}


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by pixeline

    I find it annoying when the admin footer tells you that a new Wordpress version is available (for example “Get Version 4.6.1”) but does not tell you what your current version is.
    Here is a patch:

    // Improve Admin footer update notice.
    if (!function_exists('smarter_update_footer')){
    	function smarter_update_footer( $msg = '' ) {
    		if ( !current_user_can('update_core') )
    			return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
    
    		$cur = get_preferred_from_update_core();
    		if ( ! is_object( $cur ) )
    			$cur = new stdClass;
    
    		if ( ! isset( $cur->current ) )
    			$cur->current = '';
    
    		if ( ! isset( $cur->url ) )
    			$cur->url = '';
    
    		if ( ! isset( $cur->response ) )
    			$cur->response = '';
    
    		switch ( $cur->response ) {
    		case 'development' :
    			return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) );
    
    		case 'upgrade' :
    			return '<strong>'.sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ).' - <a href="' . network_admin_url( 'update-core.php' ) . '">' . sprintf( __( 'Get Version %s' ), $cur->current ) . '</a></strong>';
    
    		case 'latest' :
    		default :
    			return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
    		}
    	}
    	add_filter( 'update_footer', 'smarter_update_footer', 9999);
    }
    

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