Table of Contents
What Are Custom Fields and What Are They Used For?
Custom fields in WordPress allow users to add extra metadata to posts, pages, or custom post types. While WordPress provides basic fields like title, content, and publication date by default, custom fields let you add specific data tailored to your needs.
For example, if you run a movie website, a standard post might include a title and description, but custom fields enable you to store additional details such as release year, genre, or IMDb rating. These extra fields make your content more structured and easier to organize.
With plugins like Advanced Custom Fields (ACF) or Secure Custom Fields (SCF), you can create and manage custom fields containing different types of data, including text, numbers, images, and dates. By integrating these fields with wpDataTables, you can display them in dynamic tables, apply filters, and make your data more accessible and interactive.
Common Use Cases
- Extending posts with additional details like author bios, reading time, or featured badges.
- Enhancing custom post types with specific fields, such as movie details (genre, release year, IMDb rating, etc.).
- Storing structured data for WooCommerce products, including specifications, pricing, or SKU.
- Managing dynamic content for complex layouts or advanced functionalities.
By integrating custom fields with wpDataTables, you can create dynamic tables that visualize this metadata, making it easier to manage and display structured information.
How to Create Custom Fields Using ACF and implement them in a wpDataTable
Example: We’ll create a Movies custom post type, add relevant custom fields using ACF, and display this data in a wpDataTable.
Step 1: Add the ACF plugin
- Navigate to Plugins > Add New Plugin
- In Search Plugins enter ACF
- Click Install Now and Activate


Step 2: Add Custom Fields with ACF
- Navigate to Advanced Custom Fields > Field Groups
2. Create a new field group Add New > “Movie Details“


Step 3: Create Posts for Movies
- Add fields like:
- Field Label: Genre
- Field Name: genre
- Field Type: Text
- Field Label: Release Year
- Field Name: release_year
- Field Type: Number
- Field Label: Rating
- Field Name: rating
- Field Type: Number
- Field Label: Poster
- Field Name: poster
- Field Type: Image
- Set the location rules to show these fields only for the “Movies” post type
- Save the field group


Step 3: Add Data to Posts
- Go to Movies > Add New
- Fill in the post title, content, and custom fields (Genre, Release Year, Rating, Poster)
- Publish the posts
Using ACF Fields in wpDataTables with WP Post Table
Step 1: Create a WP Post Table
- Click on “Build a WP Post Table”
- Click “Next”


Step 2: Configure the Data to Display
- Enter table name
- Set Post Types to “Movie” – optional, only to include these posts we’ve made for our movies
- Enable additional information fields as needed
Step 3: Include Custom Fields
- Select the Custom Fields tab
- Click on “+ Add New Custom Field Column“
- Enter “Column Header“
- Enter “Custom Field” – the Field Name you created in ACF
- Click “Next“
- Click “Create the table“


Step 4: Additional Customization and Publishing
- Customize the table further to fit your needs
- Click “Save Changes“
- Publish the shortcode of the table to your page

User Benefits
- Enhanced flexibility to manage structured data and metadata.
- Simplified integration of complex datasets into WordPress posts.
- Ability to dynamically use metadata in wpDataTables for customized displays.
- Easier troubleshooting and content updates, as data is organized and accessible via custom fields.
- A clear understanding of post metadata structure for resolving issues quickly.
- Enables detailed and attractive data presentations, like movie comparisons or product showcases.
- Easy updates to tables and posts without involving developers.
- More engaging user experiences by presenting tailored data with dynamic tables.