Today, Lao Zuo received a reminder from several WordPress program websites to automatically upgrade to version 4.2.3 when he logged into the mailbox, because if there is a website program with an automatic upgrade version set, it will automatically upgrade when it is officially pushed to a new version, which has already appeared in the new version. If we need to set a non automatic upgrade version, we can manually upgrade by ourselves. Lao Zuo's personal suggestion is that if our WordPress uses simple themes and uncomplicated plug-ins, we can set an automatic upgrade version, so that we don't need to log in to the background to upgrade when the new version is available.
At the same time, the upgrade of WordPress program version is quite particular. If we are numb to see the new version and click the upgrade directly in the background, it may lead to upgrade errors, and in serious cases, the website interface will become blank and incompatible. So in this article, Lao Zuo simply shares the complete and correct WORDPRESS upgrade method.
First, turn on/off WordPress automatic update
If we need to turn WordPress automatic update on and off, we can add the following corresponding script in the current theme functions.php file.
#Turn off automatic update of current theme, plug-in and translation
add_ filter( 'automatic_updater_disabled', '__return_true' );
#Automatic update of small version
add_ filter( 'allow_minor_auto_core_updates', '__return_false' );
#Automatic update of large version
add_ filter( 'allow_major_auto_core_updates', '__return_false' );
#Plug in automatic update
add_ filter( 'auto_update_plugin', '__return_false' );
#Turn off automatic update in wp-config.php under the root directory of the configuration file
define( 'AUTOMATIC_UPDATER_DISABLED', true );
If we need automatic update or turn off automatic update, we can set script. Generally, we'd better update manually to avoid update errors.
Second, WordPress automatically updates
If we set non automatic update, after the new version is officially pushed out, we can see a new version update prompt in the background of the WordPress program, and we can follow the prompt to update the wizard.
However, in order to ensure that the latest version can be updated smoothly, we need to pay attention to the permissions in the current program, because on the premise of ensuring the security of the website and server, we will separately set the permissions for files and directories to prohibit writing. Before upgrading, we need to ensure that they are enabled, and then set them after upgrading.
Here, we need to note that before clicking Auto Update, we need to disable all plug-ins from running. Otherwise, the upgrade may lead to incompatible plug-ins.
It should also be noted that before upgrading, whether manually or automatically, we should first back up the website database and files, so that we can recover data if problems occur. After clicking Upgrade, we will automatically go to the latest version and check if there is no problem. We will start the plug-ins one by one until we select some pages to see if there is any problem.
Third, the manual upgrade method of WordPress program
If we don't like automatic upgrade, we can also use a more appropriate manual upgrade method, because in the entire upgrade process, the script is basically adjusted in the existing file, and the file is basically unchanged. We can replace the new version.
1 - Backup website
We also mentioned above that we need to back up the website whether it is an automatic or manual upgrade.
2 - Update the latest file
We can download the latest version from the official website, and then delete the files in the wp includes and wp admin folders of the old website and replace them with the files of the latest package. Do not replace the contents of the wp content folder, but replace the latest ones.
3. Perform Upgrade
After replacement, you can enter http://our website domain name/wp admin/upgrade.php into the browser, and then perform the upgrade.
You will see this interface after upgrading.
Similarly, during the entire upgrade process, we can first disable all plug-ins, and then start them after the upgrade is completed to ensure integrity.
To sum up, whether we are manual or Automatically upgrade WordPress For programs, we must backup the data before upgrading. Secondly, we need to close all plug-ins to prevent compatibility problems. Wait for the upgrade before starting. After starting, we can update the cache and fixed links to check whether the page is complete.