Title: Sorting or other Table Features for Site Visitors are not working
Author: Tobias Bäthge
Published: August 25, 2013
Last modified: May 28, 2025

---

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

# Sorting or other Table Features for Site Visitors are not working

If the [“Enable Visitor Features”](https://tablepress.org/faq/documentation-datatables-javascript-library/)
checkbox is checked on a table’s “Edit” screen, but functions like sorting, search,
pagination, or from TablePress Premium modules are not working in your tables, this
usually indicates a JavaScript problem.

To check for that, please use the built-in “Developer Tools” of your browser. Right
click your page and pick “Inspect Element”. You should then see the “Developer Tools”,
where you can switch to the “Console” tab to see JavaScript problems on the page.

Depending on the shown error messages, we can then narrow down the cause. Here’s
a list of common possible error messages and their causes:

## Error: `Uncaught TypeError: Cannot read property 'mData' of undefined`

This error message indicates a problem with the table structure. The DataTables 
JavaScript library requires that the table has a rectangular structure, which means
that every row must have the same number of cells. Unfortunately, this means that
it is not possible to use both the JavaScript features and cell merging/combining,
using the `#colspan#` or `#rowspan#` keywords, at the same time. You will have to
decide what’s more important for your table: Using the JavaScript features or combining
cells. Having both for one table is not possible.

If you are not using the `#colspan#` or `#rowspan#` keywords in the affected table,
chances are high that the HTML code in your table is broken somewhere. A visual 
indicator for this can be that content or cells in the table are shifted, e.g. they
are shown on the left of the other cells in the same column. Very often, this happens
when using HTML code for a link in the table. It is very important that e.g. quotation
marks `"` are used properly around the values of HTML tag attributes, e.g. around
the URL after the `href=` attribute. Please check that this is the case for all 
HTML tags in your table.

## Error: `Uncaught ReferenceError: jQuery is not defined`

A common reason for this error message is the use of plugins that minify, concatenate,
or try to optimize the loading of JavaScript or CSS files on your site. Due to the
large variety of plugins, these sometimes can not properly maintain script dependencies
or the necessary loading order of files. If you see this error, you should therefore
try again after temporarily deactivating any such JavaScript/CSS optimization plugins.

Another reason for this is error could be that an old and outdated version of the
jQuery JavaScript library is loaded on your site. There are some themes and plugins
that still do this, even though WordPress already ships with the correct and up-
to-date version of jQuery. To check for this, please search the generated HTML source
code of the page with the table (accessible via the “View Source” feature in your
browser) for the string `jquery`. If there’s more than one result within HTML `<
script>` tags, this means that the library is loaded multiple times. If that is 
the case, the loading of the old versions should be stopped, so that only the version
that comes with WordPress is loaded. This usually means deleting a line similar 
to

    ```language-xml
    <script src="/js/jquery.js">Code language: HTML, XML (xml)
    ```

from the theme’s “header.php” file. Other variants are lines like

    ```php
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', ... );Code language: PHP (php)
    ```

in the “functions.php” file.

## No or other error messages

If you don’t see any JavaScript errors, please make sure that the “Enable Visitor
Features” checkbox is really checked on the table’s “Edit” screen. Please also check
if the JavaScript code that loads and initializes the DataTables JavaScript library
is part of the generated HTML source code of the page. To check for this, please
search that source code (again accessible via the “View Source” feature in your 
browser) for e.g. `datatable`.

If you are seeing other error messages than those from above, or if you are seeing
other unexpected behavior of the JavaScript library, please get in touch with the
[TablePress support team](https://tablepress.org/support/), and make sure to include
a link to the page with the table where this error happens!