company logo

Help center

Go to wpDataTables
YouTube Channel
All collectionsFAQAdvanced filteringHow Can I Show Only the Logged-in User’s Data in wpDataTables?

How Can I Show Only the Logged-in User’s Data in wpDataTables?

Pre-filter your table so each user sees only their own rows — whether it's editable or not.

If you want to show only rows related to the currently logged-in user, there are two possible approaches depending on your table type:

✅ For editable tables

You can use our built-in feature that lets users see and edit only their own data.
Just follow this guide:
👉 https://wpdatatables.com/documentation/front-end-editing/allowing-users-to-edit-only-their-own-data/

This will automatically filter the table for each user’s user ID behind the scenes.


🔧 For non-editable tables

If your table is not editable (e.g., based on a Google Sheet, Excel, or similar), there’s a simple workaround using a placeholder:

Step 1: Add a user_id Column

First, edit your source (e.g., Google Sheet or Excel) and add a column named user_id.
Populate this column so that each row is associated with the relevant user’s WordPress user ID.


Step 2: Set Filter Type to Text & Use Placeholder

In wpDataTables, edit the column settings for user_id and:

  • Set the Filter type to Text

  • Add a Predefined filter value using the placeholder: %CURRENT_USER_ID%

Here’s how the table looks before any filter is applied — all rows are visible.

And now, when the pre-filter is active, and the Administrator is logged in (user ID = 1 in this example), only the rows matching that user ID are shown.

💡 Need more details on placeholders?
Check out our documentation here:
Using Placeholders in wpDataTables


Hide the Filter Field from Front-End (Optional)

Even though the filter works, the user_id filter input is still visible on the front-end. If someone manually clears or changes it, they could potentially see all rows.

To prevent this, we’ll hide the filter field using custom CSS.

  1. Open the Customize tab in your table settings.

  2. Use your browser's Inspect Element tool to find the correct selector.

  3. Add custom CSS like this:

#table_1_5_filter_sections {
    display: none;
}

Now, the user_id filter is hidden on the front-end.

(Optional) Hide the user_id Column

If you'd also like to hide the user_id column from front-end users:

  • Either disable it from the Column settings

  • Or use the Column list button from the backend to toggle visibility

    That’s it! If you have any questions, feel free to reach out to our Support.

Did this answer your question?
😞
😐
😁