Replace WordPress with a Know Good Copy

Here is a way to replace wordpress files with known good copies.

Download WordPress files from GitHub repository

The wp-content folder and the wp-config.php file are the only unique items in wordpress. (with the exception of domain verification files.) It contains media, plugins, and themes. Download a fresh copy of the WordPress files from the GitHub repository.

Download files

git clone

Remove the wp-content directory from the WordPress directory

rm -rf WordPress/wp-content

Copy the wp-config.php file from html directory to the new WordPress directory

cp -a html/wp-config.php WordPress/

Copy the wp-contents dir from the html directory to the new WordPress directory

cp -a html/wp-content WordPress/

Swap the html directory with the WordPress directory

mv html html.old; mv WordPress html

Update permissions on new html directory

cd html; nkwordpress -op .

Leave a Comment