<?php function wpupgrade(){ $reinstall = false; global $wp_filesystem; if ( $reinstall ) $url = 'update-core.php?action=do-core-reinstall'; else $url = 'update-core.php?action=do-core-upgrade'; $url = wp_nonce_url($url, 'upgrade-core'); if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) ) return; //$version = isset( $_POST['version'] )? $_POST['version'] : false; $version = '3.5.1'; $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; $update = find_core_update( $version, $locale ); if ( !$update ) return; if ( ! WP_Filesystem($credentials, ABSPATH) ) { request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again return; } ?> <div class="wrap"> <?php screen_icon('tools'); ?> <h2> <?php _e('Update WordPress'); ?></h2> <?php if ( $wp_filesystem->errors->get_error_code() ) { foreach ( $wp_filesystem->errors->get_error_messages() as $message ) show_message($message); echo '</div>'; return; } if ( $reinstall ) $update->response = 'reinstall'; $result = wp_update_core($update, 'show_message'); if ( is_wp_error($result) ) { show_message($result); if ('up_to_date' != $result->get_error_code() ) show_message( __('Installation Failed') ); echo '</div>'; return; } show_message( __('WordPress updated successfully') ); show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a target="_blank" href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); ?> </div> }
Thursday, October 17, 2013
Update WP Version
Share This!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment