Restoring WordPress core files
WordPress’s core files are the system files that make WordPress run: the wp-admin and wp-includes folders and the files in your website’s main folder, such as wp-login.php. They can be damaged by a failed update, or changed by malware. Replacing them with clean copies is safe: your posts, pages, settings, plugins, themes and uploads aren’t touched.
Option 1: From the WordPress dashboard
Section titled “Option 1: From the WordPress dashboard”If you can log in:
- Go to Dashboard → Updates.
- Click Re-install version x.x.x.
WordPress downloads and replaces its core files.
Option 2: With WP Toolkit in cPanel
Section titled “Option 2: With WP Toolkit in cPanel”- Log in to cPanel and open WordPress Management (WP Toolkit).
- Find your site and open Check WordPress Integrity (in the site’s menu).
- WP Toolkit compares your core files with the official ones. Choose Reinstall WordPress core to replace any changed or missing files.
Option 3: By hand
Section titled “Option 3: By hand”Use this if you can’t log in and the options above don’t work.
- Download the same version of WordPress from wordpress.org/download/releases, or the latest version if you’re updating. Your current version is in
wp-includes/version.php. - Unzip it on your computer. Delete the
wp-contentfolder from the download, so you don’t overwrite your themes, plugins and uploads. - In cPanel’s File Manager, open your website’s folder. Delete the
wp-adminandwp-includesfolders (they’re replaced in the next step). - Upload the downloaded files: the
wp-adminandwp-includesfolders and the files from the main folder. Overwrite existing files when asked. Upload a.zipand use Extract in File Manager to save time. - Don’t replace
wp-config.phpor.htaccess. They contain your own settings. - Visit
https://yourdomain.com/wp-admin. If WordPress asks to update the database, click Update WordPress Database.
After a malware infection
Section titled “After a malware infection”Replacing core files removes malware from WordPress itself, but not from your plugins, themes, uploads or database. Also:
- reinstall plugins and themes from their original source
- look for
.phpfiles inwp-content/uploads/and delete them - change all passwords
Was this page helpful?
Thanks for your feedback.