Display a MySQL Table on a WordPress Page (No Custom PHP)
You have data in a MySQL table and you want to display it on a WordPress page. Sounds simple. In practice, most table plugins don’t support this — they only display data you enter manually through their own interface, not data that already exists in your database.
This tutorial shows how to connect any MySQL table to a WordPress page using the NMR jsGrid plugin — with filtering, sorting, and AJAX pagination included.
Why Most Plugins Don’t Work Here
Plugins like TablePress and Ninja Tables are designed for manually-managed tables. You enter data in their admin interface, and they display it. To show data from a custom MySQL table, you’d need to:
- Export your data to CSV
- Import into the plugin
- Repeat every time data changes
That’s not a display solution. That’s a data sync problem you didn’t need to have.
NMR jsGrid reads directly from your MySQL table at request time. No sync, no export, no stale data.
Prerequisites
- WordPress site with database access
- A MySQL table you want to display (WordPress table or custom table)
- NMR jsGrid plugin installed and activated
Step 1: Know Your Table Structure
Before configuring the grid, know the name and columns of your table. If you’re unsure, you can check in phpMyAdmin or run:
DESCRIBE your_table_name;
Write down the column names exactly — you’ll need to match them in the grid configuration.
Step 2: Create a New Grid
WordPress Admin → NMR jsGrid → Add New Grid.
Set a grid ID. This will be used in the shortcode — keep it short and lowercase, no spaces. Example: products, members, orders.
Step 3: Set Data Source to SQL
In Data Source, select SQL. Enter a SELECT query:
SELECT id, name, email, status, created_at
FROM wp_members
ORDER BY created_at DESC
You can use any valid SELECT query — including JOINs, WHERE clauses, aliases, and subqueries. The plugin executes this as-is (with LIMIT/OFFSET added for pagination).
Tip: Use column aliases in your SELECT if you want friendlier names for filtering. For example: first_name AS "First Name". Then set the column Name in the grid config to match the alias.
Step 4: Define Columns
Add one column per field in your SELECT. For each:
- Name: exact field name from your query (or alias)
- Title: column header text shown to users
- Type: text / number / date / checkbox / textarea
- Width: optional, in pixels
- Filtering: on or off per column
- Sorting: on or off per column
Step 5: Set Pagination Options
In Grid Options:
- Page Size: rows per page (10, 25, 50, 100)
- Paging: enable/disable pagination
- Autoload: load data automatically on page open (recommended: on)
Step 6: Save and Embed
Save the grid. Open any WordPress page or post. Add a Shortcode block:
Publish. Your MySQL table is now displayed with filtering and pagination.
Works With
- WordPress core tables (wp_posts, wp_users, wp_usermeta, wp_comments)
- WooCommerce tables (wp_wc_orders, wp_woocommerce_order_items)
- Custom plugin tables
- Legacy application tables in the same MySQL database
- Any table accessible by the WordPress DB user