We reply within one business day.

Insights / Web Design / Hacked WordPress Site Recovery: Rebuilding From a Da…

Hacked WordPress Site Recovery: Rebuilding From a Database

The attacker deleted WordPress and the theme. All that survived was a database export. Here is how we rebuilt a clean, hardened site from it.

A diagram of what lives in a WordPress database and what lives in files

Project highlights

  • A hacked WordPress site with the server files destroyed and only a database export left
  • 106 pages, 37 data tables and 13 forms restored, with every page URL kept
  • No malicious code found in the content, and one controlled admin account instead of six
  • 149 media files recovered from public archives, and a prioritized list built for the client to return the rest
  • A reviewable rebuilt site about two days after we received the files, now live on the client’s own domain

A hacked site, a wiped server and one database export

A North Carolina industrial equipment manufacturer had a WordPress website of about 100 pages: products, services, press releases and a multilingual catalog, all built with Elementor. The site was compromised. The attacker corrupted a file, then deleted WordPress and the theme from the server.

We do not disclose the names of the companies that reach out to us to repair a hacked site. That is why this case study is anonymized, and it is how we treat every recovery.

What survived was a 335 MB database export with 108 tables and an XML export of the content. There were no theme files, no plugin files and no uploads folder, which is where WordPress keeps every image and document. The site also depended on a customized commercial theme that could not be reinstalled, and on four premium plugins: Elementor Pro, TranslatePress, TablePress Premium and Yoast Premium.

The client needed a working site again, without reusing anything from the compromised environment.

A diagram of what lives in a WordPress database (pages, menus, layouts, settings) and what lives in files (theme, plugin code, uploads), showing what survived the attack

What a database can and cannot rebuild

This case turns on one idea. A WordPress database holds the content: pages, posts, menus, settings and Elementor layouts. It does not hold the theme files, the plugin code or the media library. So the job was to rebuild everything the files provided, and to prove that nothing the attacker touched came back with it.

What we did

1. Investigated before touching anything

We loaded the database into an isolated quarantine copy with a restricted user, after scanning the export for triggers, functions and file-writing commands. We inventoried content, templates, menus, plugins, users and every Elementor widget type, then searched posts, post data and settings for injected code and unexpected outside domains.

The content was clean. The only script hits were legitimate tracking tags, which pointed to a server-level attack rather than tampered pages. The weak spots were in the settings: new users defaulted to the administrator role, six administrator accounts existed (one left over from a template demo), a remote-management plugin was installed, and licence keys and mail logins were stored in the database. We could not determine how the attacker got in from the data, so we advised the client to ask the old host for its server logs.

2. Sanitized the database

We removed every existing user and created one known administrator, set the default role to subscriber, cleared stored sessions, and deleted licence keys, API keys, mail logins, remote-management keys, cached data and the scheduled-task list. Log, cache and firewall tables were dropped. Every change went into a written log.

3. Rebuilt on a clean install

On a fresh WordPress install with a lightweight base theme and a small child theme, we put the URLs back, including the ones Elementor stores in escaped form. We rebuilt what the lost theme and premium plugins had provided: 13 forms, the home page slider, the header and footer, menus and page templates. Later, when the client supplied its licence and the vendor downloads, we restored the original Elementor Pro forms and slider. Every vendor file was scanned for obfuscated code, hidden PHP, unexpected hosts and licence-bypass markers before anything was installed.

4. Recovered the media library

The library held 574 items: 525 images, 47 PDFs and 2 videos. We matched them against the Internet Archive by path and file name and recovered 149, including 42 of the 47 PDFs and 138 of the 402 images used on live pages. Every file was type-checked before use.

For the rest we built a prioritized request list, ranked by whether an item appears on a live page, so the client could find and return the remaining 425 files. The library refills automatically from whatever folder they send. Until then, a neutral “Image coming soon” placeholder, sized to match the original, appears in place of any missing image, so no page shows a broken-image icon. Dropping the real file at the same path replaces the placeholder with no page edits.

5. Polished the design

Twenty-seven pages had more than one H1 heading and 27 had duplicated page titles, and all are fixed. We tightened the sticky header, rebuilt the footer, restyled the forms (the submit button had disappeared when the theme was lost), and polished the home page, the press-release list and the search results page. Plugins that nothing used were removed.

6. Hardened a new home for the site

The site now runs on a new, separate hosting account on PHP 8.4. The default login addresses are blocked and replaced with a private one, administrators sign in with two-factor authentication, and login attempts are limited. XML-RPC is off, the WordPress version is hidden, file editing from the dashboard is disabled, system folders are protected, and security headers are set. The site no longer reveals user names, application passwords are off, most plugins and all themes update automatically, and the host takes daily backups. The restored site was reviewed behind a temporary link, hidden from search engines, and is now live on the client’s own domain.

Results

MeasureResult
Pages restored106 published pages, with hierarchy and URLs intact
Data tables restored37 product and specification tables
Forms13 forms on 9 pages
LanguagesThe multilingual site is back, with 6 extra languages running
Media library574 items; 149 (26%) recovered from archives; 425 requested from the client
Images used on live pages138 of 402 recovered
Malicious code in the contentNone found
Administrator accounts6 unknown or leftover accounts replaced by 1 controlled account
Pages with exactly one H1106 of 106 (up from 79)
Duplicate on-page titles removed27
Time to a reviewable siteAbout two days from receiving the files

The restored site is now live on the client’s own domain. Media counts are from the review build and will change as the client returns more files. We have not measured page speed or search results for the rebuilt site yet, so we make no claims about them here.

What we learned

  • A database dump can rebuild a lot. Content, menus, page structure and Elementor layouts all live there. Theme files, plugin code and media do not.
  • Back up the uploads folder too. It was the biggest gap. Only about a quarter of the media could be recovered from public archives. Our guide to backing up a WordPress site shows what a complete backup includes.
  • Premium plugins are a recovery dependency. Keep licence details and vendor download access somewhere safe, separate from the site.
  • Treat every recovered file as hostile. Dumps, exports, uploads and even vendor downloads get scanned before anyone uses them.
  • Defaults matter. A default role of administrator and old admin accounts are classic weak points. See our WordPress security guide, and our monthly website maintenance checklist covers the habits that close them.

Frequently asked questions

Can a hacked WordPress site be restored from just a database?

Often, yes. Pages, posts, menus, settings and Elementor layouts are in the database. Theme files, plugin code and the media library are not, and need to be rebuilt or recovered.

How do you know the restored site is clean?

We audit the database for injected code, remove unknown users and stored logins, rebuild on a fresh WordPress install, and scan every plugin file before installing it.

What if the images are gone?

We check backups and public archives such as the Internet Archive, give the client a prioritized list of what is missing, and use neutral placeholders so the site is never broken while the files come back.

Will this happen again?

No site is risk-free, but a fresh host, two-factor login, a firewall, limited admin accounts, automatic updates and tested backups remove the most common weak points.

How long does a recovery take?

This one reached a reviewable site in about two days. Timing depends on how much of the site, especially the media and premium plugins, survives.

Hacked or locked out of your WordPress site?

We are a Charlotte web studio, in practice since 1998, and we take on recovery and rescue work for organizations across the Carolinas and beyond. If your site was hacked, if a previous build did not deliver, or if you only know something is wrong, talk to us. We will start with a free written second opinion on where your site stands, and we will never disclose your name. You can also read about our hacked WordPress site repair service.

More on case study

See the project at a glance.

Send the URL. Get a free written audit.

Speed, search, security and conversion, read by Michael himself. Free, no obligation, and a reply within one business day.

"*" indicates required fields

This form is protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.

Three doors. Pick the one that fits today.

Let's talk Charlotte, NC, Remote nationwide

Let's build something worth keeping.

Most of our best engagements start when a previous build did not deliver. That is a comfortable conversation here, and we will write a plan around it.

In practice since
1998

Founded in DUMBO, Brooklyn. Practicing in Charlotte, NC. Twenty-eight years and counting.