Table of Contents
How to show ACF and SCF custom fields in a wpDataTables table
Say you run a movie site and store each film as a post with extra fields for its genre, release year and rating. You want a page that lists all the films with those details, which visitors can sort by rating or filter by genre. wpDataTables reads custom fields made with Advanced Custom Fields (ACF) or Secure Custom Fields (SCF) and shows them as columns next to the post title, so the table stays up to date as you add films.
What are custom fields?
Custom fields store extra data on posts, pages and custom post types, beyond the title, content and date that WordPress has by default. Plugins such as ACF and SCF let you create them with types such as text, number, image and date. Common uses are:
- details of a custom post type, such as a movie’s genre, release year and rating,
- extra information on posts, such as reading time or a featured badge,
- product specifications in WooCommerce, such as the brand or material.
Which tables can show custom fields?
Custom fields can be added as columns in tables built with WP Post Builder, and in WooCommerce product tables. In both, you add them in the Custom Fields tab while you create the table.
How do I create the custom fields?
Create a field group in ACF or SCF, add the fields, and show the group only for the post type you want. For the movie example:
- Install the plugin. Go to Plugins → Add New Plugin, search for ACF or Secure Custom Fields, and click Install Now and Activate.
- Add a field group. Go to the plugin’s Field Groups page, click Add New and name the group Movie Details.
- Add the fields. Add a field for each detail. Note each Field Name, because wpDataTables uses it:
| Field Label | Field Name | Field Type |
|---|---|---|
| Genre | genre |
Text |
| Release Year | release_year |
Number |
| Rating | rating |
Number |
| Poster | poster |
Image |
Set the location rule so the group shows only for the Movies post type, save the group, and fill in the fields for each movie when you add or edit it.
How do I add custom fields as columns?
Create a WP Post table, open the Custom Fields tab, click + Add New Custom Field Column, and enter a header and the field name for each field.
- Start the table. Go to wpDataTables → Create a Table and click Build a WP Post Table.
- Choose the posts. Type a table name and, in the General tab, set Post types to your post type, for example Movies.
- Add a column. Open the Custom Fields tab and click + Add New Custom Field Column.
- Fill in the column. In Column Header, type the header visitors will see, for example Genre. In Custom Field, type the field name, for example
genre. Click + Add New Custom Field Column again for each other field, and remove a column with its trash icon. - Create the table. Click Next, check Preview the 5 first result rows, then click Create the table.

After the table is created, customize the columns in the editor, click Save Changes and add the table to a page with its shortcode. For WooCommerce products, add the fields the same way in the Custom Fields tab of a WooCommerce table, as in how to show product custom fields.
What should I remember about custom fields?
Create the fields with ACF or SCF and note their field names. In a WP Post or WooCommerce table, open the Custom Fields tab, click + Add New Custom Field Column, and enter a column header and the field name. The table reads the field values from your posts on every page load.
Where can I read more?
These pages go further with tables of WordPress content: