Table of Contents
How to let users see and edit only their own data in wpDataTables
Say your customers order printed signs through your site, and each of them should see and change only their own orders, never the orders of others. You don’t need a separate table per customer. One editable table with a user ID column does it: wpDataTables saves the ID of the logged-in user with every new row and shows each user only the rows that carry their ID.
How does editing only their own data work?
wpDataTables stores the ID of the user who adds a row in a user ID column, and then shows and lets each user edit only the rows with their ID. Users get the full set of actions, adding, viewing, editing and deleting, for their own rows, and they never see the rows of others. All you need is an editable table with an integer column for the user ID. In a manual table you add that column yourself, and in a table built on your own MySQL table you prepare an integer column for it.
How do I create a table with a user ID column?
Create a manual table and add an Integer column for the user ID next to the columns users fill in. For an orders table:
- Start the table. Go to wpDataTables → Create a Table, click Create a data table manually and name the table, for example My orders.
- Add the columns. Set up four columns:
| Column | Type | Possible values |
|---|---|---|
| Order date | Date | |
| Product | One-line selectbox | Rectangle, Circle, Square |
| Comment | Multi-line string | |
| User ID | Integer |
- Create the table. Click the arrow on Create the table and choose Open in standard editor.
How do I turn on editing only their own data?
In the Editing tab, turn on Allow front-end editing and Limit editing to own data only, choose the user ID column and click Save Changes.
- Turn on editing. In the table editor, open the Editing tab and, under Allow editing, turn on Allow front-end editing.
- Limit users to their rows. Under Users see and edit only own data, turn on Limit editing to own data only.
- Choose the column. In User ID column, choose the User ID column. The list shows its database name, for example
userid. - Choose who can edit. In Editor roles, choose the roles of your users, for example Subscriber or Customer.
- Hide the user ID. Open the settings of the User ID column and turn off its visibility on the front end, because users don’t need to see it.
- Save the table. Click Save Changes.

Video: limiting editing to a user’s own rows and editing one as an Author.
Add the table to a page with its shortcode. Each logged-in user now sees an empty table, adds rows with the add button, and sees only those rows. When another user logs in, they don’t see them.
Which other options work with own data?
Two more options in the Editing tab change what users and admins see:
| Option | What it does |
|---|---|
| Show all rows in back-end | Turn on Show all rows for this table in admin area to show all rows of all users in the WordPress admin, so you can manage every order. It also works for tables from the Gravity Forms integration. |
| Show all values from the foreign key table | When a column is a foreign key, shows all values of the other table in the edit window, not only the values of the current user. |
What should I remember about users’ own data?
Add an Integer user ID column to an editable table, turn on Limit editing to own data only, choose the column in User ID column, choose the editor roles and hide the column. wpDataTables then saves the user’s ID with every new row, and each user sees and edits only their own rows.
Where can I read more?
These pages go further with editable tables: