WordPress: How to downgrade to a previous version

I recently updated this blog to WordPress version 5.1.1, only to find that one of my plugins called CodePen Embedded Pens Shortcode stopped working. I didn’t think to deactivate, reinstall, and reactivate the plugin again in the new version, which would have solved the problem, so instead I looked for options for rolling back my WordPress to an earlier version. This article details how to do that.

To safely roll back to a previous version, do the following:

Step 1: Download a fresh copy of the previous WordPress version

Previous versions of WordPress can be downloaded here:
https://wordpress.org/download/releases/

In my case I wanted to roll back to version 4.7, so I clicked the .zip to download it.

Step 2: Deactivate all of your plugins

In the WordPress dashboard, click the top checkbox to check all plugins and then choose Deactivate –> Apply.

Step 3: Log out of WordPress

Step 4: FTP into your WordPress server location

Once logged into your WordPress site via an FTP program like FileZilla, delete the wp-admin and wp-includes folders.
Note: DO NOT delete the wp-content folder!

Step 5: Upload previous version WordPress files via FTP

Now with the same FTP connection, upload wp-admin, wp-includes, and the rest of the wp files from the version of WordPress that you are downgrading to. These files will overwrite the WordPress files on your server.
Note: DO NOT overwrite the wp-content folder!

Step 6: Log back in and update your WordPress database

Once you log back into your WordPress dashboard, you will be prompted to update your WordPress database. Click the button that says Update WordPress Database, and then the downgrade to previous version of WordPress will be complete.