Title: Tables are corrupted and show &#8220;[ERROR] TABLE IS CORRUPTED&#8221;
Author: Tobias Bäthge
Published: August 25, 2013
Last modified: May 14, 2025

---

Back to: [Frequently Asked Questions](https://tablepress.org/faq/?output_format=md)•
[Documentation](https://tablepress.org/documentation/?output_format=md)

# Tables are corrupted and show “[ERROR] TABLE IS CORRUPTED”

While seeing this error is (understandably) scary, please remain calm—in almost 
all cases it’s possible to restore the table data. This page tries to provide some
guidance for that.

## Background

Internally, TablePress stores tables as two-dimensional fields or arrays. To be 
able to store these in the database, these arrays are encoded to text strings in
the [JSON](https://en.wikipedia.org/wiki/JSON) format. In this widely used and open
data format, certain characters like quotation marks `"`, backslashes `\`, and square
brackets `[]` serve as control characters and have special meanings. Therefore, 
when these characters are used in the actual content, precautions have to be taken
to not mix them up with their control character function when it comes to reading(
decoding to its original representation) the JSON text string again. This is done
by [escaping](https://en.wikipedia.org/wiki/Escape_character) these characters with
a prepended backslash `\`. For example, a quotation mark `"` is actually stored 
as `\"` internally.

All this is completely irrelevant when working with tables in TablePress, as everything
regarding loading (decoding) and storing (encoding) the data happens automatically
behind the scenes. The escaping however is one reason why JSON text strings are 
fragile when it comes to direct data manipulation—that is when working with the 
stored JSON data as plain text outside of TablePress—in contrast to first decoding
it to its original data structure.

For example, a process that works with a raw JSON text string must never add extra
quotation marks `"` to it, but it needs to appropriately escape them as `\"` first.
It is also not directly allowed to just append or add extra content or data to the
end of a JSON string that represents an array internally. If such a wrong data manipulation
is done, the JSON text string will not have the correct format for it to be decoded
to its original representation again—the JSON data is corrupted.

## Causes for table data corruption

Possible causes for such corruption of TablePress tables mainly are the wrong or
careless handling of JSON content in the database, by other plugins, themes, or 
even WordPress itself, or security breaches and hacks of websites, databases, or
servers. From a more technical perspective, this can for example mean that something
on your site or server

 * removed the escaping backslashes `\`, e.g. by wrongly using the PHP `stripslashes()`
   function,
 * inserted content that includes quotation marks `"` into the JSON string, but 
   without the mandatory escaping backslashes `\`,
 * or appended extra text or code to the end of the JSON string.

While the first of these possibilities does not happen often anymore, the problem
of text or code being automatically appended to the JSON strings can still be observed
at a small but constant rate. Very often, this is done by automated scripts that
append malicious HTML and JavaScript code to all posts, pages, and tables of a site,
with the intent to possibly infect the visitors’ computers with malware or to display
ads on your site. One indicator that your site or database might have been hacked
and modified in this way is that all TablePress tables show the corrupted data error.

The second mentioned possibility became a problem for some time with the release
of WordPress 5.1 at the end of February of 2019, due to [a bug](https://core.trac.wordpress.org/ticket/46316)
in it. In most cases, only a few but not all tables on the site would be affected
here, and only if they contained certain HTML code for a clickable link.

## Fixing and restoring corrupted table data

You most likely were directed to this page by a notice on the TablePress screens
of your site, telling you that the internal data of a table is corrupted. This means
that the JSON text string that was read from the database could not be decoded into
a two-dimensional array properly. To fix the JSON text string, the wrong parts in
it have to be identified and either be corrected or be removed. To stick with the
possible causes from the previous section, content that was added without the escaping
backslash `\` probably just needs that inserted, while extra HTML `<script>` tags
from a hacking script need to be removed from the end of the JSON code.

For most cases that we have seen in the past, this process can be automated. We 
therefore developed a WordPress plugin, the “TablePress Extension: Fix corrupted
tables”, that will do this for you.

 1. To restore your corrupted tables, please [download the “TablePress Extension: Fix corrupted tables” plugin](https://tablepress.org/download/extension/tablepress-fix-corrupted-tables.zip?output_format=md)
    as a ZIP archive to your computer.
 2. In your WordPress admin dashboard, go to “Plugins” -> “Add New”, and click the “
    Upload Plugin” button near the top.
 3. Choose the ZIP file that you downloaded in step 1 and upload it. (Alternatively,
    you could extract the ZIP archive and upload the contained folder to your site’s`/
    wp-content/plugins/` folder via your FTP program.)
 4. On the next screen, click the “Activate Plugin” button.
 5. The Extension will then try to fix the internal JSON data format of the TablePress
    tables by performing simple search/replace operations in your database.
 6. After this, you will see a notice text at the top of the screen about the process,
    including some success statistics, and a suggestion to create a backup. For this,
    the [WP Staging plugin](https://wp-staging.com/tablepress/?utm_source=tablepress&utm_medium=site)
    is a great solution, as it makes backups very easy.
 7. Finally, you may go to the “Plugins” screen and “Deactivate” and then “Delete” 
    the “TablePress Extension: Fix corrupted tables” plugin again.
 8. In addition, on the “Plugins” screen, please make sure that you have updated TablePress
    to the latest version!

Please be assured that I’m very sorry that you experienced corrupted TablePress 
tables on your site! We are doing everything we can to prevent this in TablePress,
but unfortunately, we can’t protect your table data from external influences on 
the database, like other plugins or scripts with malicious intent. It is therefore
always recommended to keep a backup of your site as a whole, and your tables in 
particular, e.g. by exporting them to files.

If you find that the Extension did not restore all your TablePress tables, it is
possible that they are corrupted in other ways. Most likely, we’ll still be able
to restore the data. For help with that, please contact us directly via email (_supportno-
spam@mailtablepress.org_) with the details to a temporary admin account to your 
site. We’ll then gladly take a direct look and assist with restoring your table 
data!

**On this page**

 1. [Background](https://tablepress.org/faq/corrupted-tables/#background)
 2. [Causes for table data corruption](https://tablepress.org/faq/corrupted-tables/#causes)
 3. [Fixing and restoring corrupted table data](https://tablepress.org/faq/corrupted-tables/#fixing)