Our Biggest Sale Is Here
Up to 70% Off
Get the Deal

How to create an editable table in WordPress with wpDataTables

Say your sales team keeps a list of open leads on the company intranet, and each salesperson should be able to add a new lead or update a status from the page itself, without access to the WordPress admin. An editable table does that. You turn on editing for the table, choose which user roles may edit, and the table on the page gets buttons to add, edit and delete rows in an edit window.

Which tables can be editable?

Tables stored in a MySQL database can be editable: manual tables, imported tables, and tables built on an SQL query that reads one table. Tables linked to a file, a Google sheet or another source can’t, because their data doesn’t live in your database. The two kinds of database tables differ in setup:

Table What you set up
Manual or imported table Only Allow editing. The MySQL table name and the ID column are already filled in, and the table is always editable in the admin.
Table built on an SQL query Allow editing, and check the MySQL table name for editing and the ID column for editing that wpDataTables guesses from the query.

How do I turn on editing for a table?

Open the table in the editor, go to the Editing tab, turn on Allow editing, choose the editor roles and click Save Changes.

  1. Open the settings. Go to wpDataTables → Tables, open the table and click the Editing tab.
  2. Turn on editing. Under Allow editing, turn on Allow front-end editing.
  3. Check the table and ID. For a table built on an SQL query, check MySQL table name for editing and ID column for editing. wpDataTables usually guesses them right when the ID column is called id.
  4. Choose who can edit. In Editor roles, choose the user roles that may edit, for example Editor and Author.
  5. Save the table. Click Save Changes.
The Editing tab of a wpDataTables table with Allow front-end editing on, the MySQL table name and ID column for editing, and Editor and Author as editor roles
Turning on editing for a table: (1) the Editing tab, (2) Allow editing, (3) MySQL table name for editing and ID column for editing, (4) Editor roles, (5) Save Changes.

Video: turning on front-end editing and opening the Edit entry window.

  • If you leave Editor roles empty, everyone can edit the table, including visitors who aren’t logged in. Always choose the roles that may edit.
  • The ID column must have a unique value in every row, ideally an auto-increment integer. With repeated IDs, one save can change several rows.

Next, choose how each column is edited, for example a date picker for dates or a dropdown for a status. Read how to choose editor input types. Hide the ID column from users in its column settings, because IDs don’t mean anything to them.

Which other editing options can I set?

The Editing tab has more options for how users edit the table:

Option What it does
Edit buttons to be displayed on the front-end Shows only the buttons you choose, for example only the edit button. The default is All.
Show duplicate button Turn on Enable duplicate button to add a duplicate button that opens the edit window with the data of the selected row, so users can add similar rows quickly.
In-line editing and Popover edit block Allow in-line editing lets users edit a cell with a double click, and Editing buttons in a popover shows the edit buttons above the clicked row. Read inline editing.
Users see and edit only own data Turn on Limit editing to own data only to show each user only the rows they added. Read how to let users edit only their own data.

How do users edit the table on the page?

Users select a row and click the edit button, or click the add button, change the values in the Edit entry window and click Submit. Add the table to a page with its shortcode, as in how to add a table to a page, and the buttons show above the table for the roles you chose.

The Edit entry window of an editable table on a WordPress page with the previous and next arrows, the row's fields and the Cancel, Apply and add new and Submit buttons
Editing a row on the front end: (1) previous and next row, (2) the fields, (3) Cancel, (4) Apply and add new, (5) Submit.

The edit window has these buttons:

Button What it does
The previous and next arrows Open the previous or next row, switching pages if needed. Unsaved changes are discarded.
Apply and add new Saves the row and opens an empty window for the next one. Hidden when only the edit button is allowed.
Submit Saves the row and closes the window.
Cancel Closes the window without saving.

wpDataTables checks the values before it saves them. If a value is wrong or the database returns an error, a message names the field to fix. After a successful save, a success message appears.

What are the limits of editable tables?

Editing has a few rules that come from how wpDataTables writes to the database:

  • A table can write to one MySQL table only, so tables built on queries that join several tables can’t be edited.
  • MySQL views can’t be edited properly. Only one of the underlying tables is updated, and only if you set the right ID column.
  • Front end editing needs server-side processing. wpDataTables turns it on automatically.

What should I remember about editable tables?

Only database tables can be editable. Turn on Allow editing in the Editing tab, always choose the Editor roles, check the MySQL table and ID column for SQL tables, and set an editor input type for each column. Users then add, edit and delete rows on the page in the Edit entry window.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box